EnvDTE以编程方式更改Visual Studio项目的调试属性 [英] Change the Debug properties of Visual Studio project programmatically by EnvDTE

查看:215
本文介绍了EnvDTE以编程方式更改Visual Studio项目的调试属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过EnvDTE类以编程方式更改调试部分中的项目属性?我知道如何获取DTE实例并使用某些设置,但是我是盲目的,否则调试部分将无法访问.我从这里开始 http://msdn.microsoft.com/en -us/library/envdte.project.dte.aspx

Is it somehow possible to change the project properties in debug section programmatically by EnvDTE classes? I know how to get the DTE instance and work with some of the settings, but I am blind or the debug section is just not accessible. I started from here http://msdn.microsoft.com/en-us/library/envdte.project.dte.aspx

推荐答案

EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.12.0");
Project project = dte2.Solution.Projects.Item(1);
Configuration configuration = project.ConfigurationManager.ActiveConfiguration;
configuration.Properties.Item("StartAction").Value = VSLangProj.prjStartAction.prjStartActionProgram;
configuration.Properties.Item("StartProgram").Value = "your exe file";
configuration.Properties.Item("StartArguments").Value = "command line arguments";

此处是属性名称列表: http ://msdn.microsoft.com/zh-CN/library/aa984055(v = vs.71).aspx

The list of property names is here: http://msdn.microsoft.com/en-us/library/aa984055(v=vs.71).aspx

这篇关于EnvDTE以编程方式更改Visual Studio项目的调试属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆