3F / MvsSln

🧩 Customizable VisualStudio .sln parser with project support (.vcxproj, .csproj., …). Pluggable lightweight r/w handlers at runtime, and more …
MIT License
135 stars 27 forks source link

Modifying Specific Projects Example... #38

Closed DynConcepts closed 3 years ago

DynConcepts commented 3 years ago

https://github.com/3F/MvsSln/issues/3

Shows how to modify a Solution, I am looking for how to modify a Project... e.g. Change the $OutDir property and update the (.vcxproj in this case) file...

3F commented 3 years ago

IXProject in 2.x wraps an msbuild, so you can simply use it separately or such as

IXProject xp = ...
xp.SetProperty("OutDir", "new-value");
xp.Save();

https://github.com/3F/MvsSln/blob/9ce5885282d65ee32bfc03808c83c1113c1928e3/MvsSln/Core/IXProject.cs#L186-L191

easy to group like

xp.SetProperties(new Dictionary<string, string>()
{ 
    { "name1", "value1" },
    { "name2", "value2" },
    { "name3", "value3" }
});
  <PropertyGroup>
    <name1>value1</name1>
    <name2>value2</name2>
    <name3>value3</name3>
  </PropertyGroup>

etc.

DynConcepts commented 3 years ago

Close but a related problem has come up... This is covered in Issue #39...

3F commented 3 years ago

I think it's time to play with new Discussions for the similar general questions like this.

@DynConcepts Please use Discussions for cases like this instead of opening new Issues. We'll test it together. Thanks.