.NET for Visual Studio projects?

Does Visual Studio provide any classes that can be used to load a project ( .vcprojfile) and change some of its properties?

Currently, our solution has about 70 projects, of which 60 are Visual C ++. I would like to experiment with some settings (optimizing on / off, changing binding settings, etc.). Unfortunately, the .vsprops file is not suitable for this purpose, since for some projects some โ€œmanualโ€ values โ€‹โ€‹(not โ€œinheritedโ€) are often set for historical reasons.

Is there any class with which I can load the project and use it? How (on my head):

using Microsoft.VisualStudio;

Project project = Project.Load("MyProject.vcproj");
project.Configurations["Debug"].CompilerSettings.OptimizationLevel = OptimizationLevel.Full;

Having such a class will allow me to quickly draw C # โ€œscriptsโ€ using LINQPad to test various configurations.

+4
source share
1 answer

As far as I know, the Microsoft Roslyn project does what you want. I never used it, but I heard a lot of good.

http://msdn.microsoft.com/en-us/vstudio/hh500769.aspx

Among other functions, it provides an object model for a solution / project. Check the chapter "Working with the workspace" in the documents.

0
source

Source: https://habr.com/ru/post/1531284/


All Articles