[英].NET classes for Visual Studio projects?
Does Visual Studio expose any classes which can be used for loading a project ( .vcproj
file) and changing some of it's properties? Visual Studio是否公开任何可用于加载项目(
.vcproj
文件)并更改其某些属性的类?
Our solution currently has around 70 projects, ~60 of which are Visual C++. 我们的解决方案目前有大约70个项目,其中约60个是Visual C ++。 I'd like to expreriment with some settings (turning on/off optimizations, changing linking settings, etc.).
我想用一些设置(打开/关闭优化,更改链接设置等)来表达。 Unfortunately, .vsprops file aren't really suitable for the purpose, as the settings for different projects are are frequently set to some "manual" value (not "inherited") for historic reasons.
遗憾的是,.vsprops文件并不真正适用于此目的,因为出于历史原因,不同项目的设置经常被设置为某些“手动”值(而非“继承”)。
Is there some class I can load the project with and tinker with it? 是否有一些课我可以加载项目并修补它? Like (off top of my head):
喜欢(在我的头顶):
using Microsoft.VisualStudio;
Project project = Project.Load("MyProject.vcproj");
project.Configurations["Debug"].CompilerSettings.OptimizationLevel = OptimizationLevel.Full;
Having such class will allow me to quickly sketch C# "scripts" using LINQPad to test various configurations. 拥有这样的类将允许我使用LINQPad快速绘制C#“脚本”来测试各种配置。
As far as I know Microsoft's project Roslyn does what you want. 据我所知,微软的Roslyn项目可以满足您的需求。 I've never used it, but heard a lot of good things about it.
我从未使用它,但听到了很多关于它的好东西。
http://msdn.microsoft.com/en-us/vstudio/hh500769.aspx http://msdn.microsoft.com/en-us/vstudio/hh500769.aspx
Among other features, it exposes the object model of a solution / project. 在其他功能中,它公开了解决方案/项目的对象模型。 Check the "Working with a Workspace" chapter on the docs.
检查文档中的“使用工作区”一章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.