-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map not Refreshing #55
Comments
Hello,
\> "when I look at “Map”, all the configurations are still there, and
are saved again accordingly."
Because your *whandlers* are empty. You need just to link your runtime
collection with related handlers then it should update.
But first of all, I recommend also look at #42 Q&A for the related things.
In particular, there I also noticed about "Any CPU" and "AnyCPU" to use
at least MvsSln's default rules or implement its IRuleOfConfig in order
to avoid problems for different environments.
tl;dr, try this:
```csharp
string file = ...
using Sln sln = new(file, SlnItems.AllNoLoad);
bool _IsNot(IConfPlatform c)
=> !c.IsEqualByRule("Debug", "Any CPU")
&& !c.IsEqualByRule("Release", "Any CPU");
using SlnWriter w = new(file, new Dictionary<Type, HandlerValue>()
{
[typeof(LSolutionConfigurationPlatforms)] = new(new
WSolutionConfigurationPlatforms(
sln.Result.SolutionConfigs.Where(c => _IsNot(c)))
),
[typeof(LProjectConfigurationPlatforms)] = new(new
WProjectConfigurationPlatforms(
sln.Result.ProjectConfigs.Where(c => _IsNot(c.Sln)))
),
[typeof(LProject)] = new(new WProject( // ... replica due to bug LC-102
sln.Result.ProjectItems, sln.Result.ProjectDependencies)
),
});
w.Write(sln.Result.Map); // Now apply changes
```
Regarding to sln.Result items you need to see both #10 and #9
FYI, to refresh Map in 2.6 you need re-open the applied changes above.
n. I may still be very slow to respond due to many reasons beyond my
control, sorry.
…On 09.09.2022 11:31, Björn Ecke wrote:
Hi,
I have a solution with over 500 projects and more than 10 build
configurations. The goal is to delete all build configurations except
for the two default ones, and to do the same for the projects. I have
read through Issue #3 <#3>, and I
can successfully remove the data from the SLN. However, when I look at
“Map”, all the configurations are still there, and are saved again
accordingly. Is there a way to update this map ?
I have attached my Code to this Request and will be thankfull for your
help.
using var sln = new Sln(openFileDialog1.FileName,SlnItems.AllNoLoad |SlnItems.PackagesConfig);
sln.Result.SolutionConfigs.ToList().ForEach(c =>
{
if (!(c.Configuration == "Debug" && c.Platform == "Any CPU")&& !(c.Configuration == "Release" && c.Platform == "Any CPU"))
((SlnResult)sln.Result).SolutionConfigList.Remove(c);
});
((SlnResult)sln.Result).ProjectConfigList.ToList().ForEach(c =>
{
if(!(c.Configuration == "Debug" && c.Platform == "Any CPU")&& !(c.Configuration == "Release" && c.Platform == "Any CPU"))
((SlnResult)sln.Result).ProjectConfigList.Remove(c);
});,
var whandlers = new Dictionary<Type,HandlerValue>();
using (var w = new SlnWriter(openFileDialog1.FileName,whandlers))
{
w.Write(sln.Result.Map);
}
Kind regards,
Björn
Message ID: ***@***.***>
|
I close the issue because as I said you just need to update your runtime collections; then save the result into file or string. Feel free to open an issue again if the problem still exists. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I have a solution with over 500 projects and more than 10 build configurations. The goal is to delete all build configurations except for the two default ones, and to do the same for the projects. I have read through Issue #3, and I can successfully remove the data from the SLN. However, when I look at “Map”, all the configurations are still there, and are saved again accordingly. Is there a way to update this map ?
I have attached my Code to this Request and will be thankfull for your help.
Kind regards,
Björn
The text was updated successfully, but these errors were encountered: