[英]Read and change project properties “Start external program” and “command line arguments”
I'm trying to read (and change) the project properties "Start external program" and "Command line arguments" of a VisualStudio 2013 project within a VSPackage. 我正在尝试读取(和更改)VSPackage中VisualStudio 2013项目的项目属性“启动外部程序”和“命令行参数”。 The code I wrote so far looks like:
到目前为止,我编写的代码如下:
var dte = GetService(typeof(DTE)) as DTE2;
if (dte == null)
return;
var sb = (SolutionBuild2)dte.Solution.SolutionBuild;
var projectNames = sb.StartupProjects as Array;
if (projectNames == null || projectNames.Length == 0)
return;
var project = dte.Solution.Item(projectNames.GetValue(0));
var config = project.ConfigurationManager.ActiveConfiguration;
But I can't find the two spcific properties neither in the project
nor in the config
. 但是我在
project
和config
都找不到这两个特殊的属性。
The EnvDTE.Configuration class has a Properties collection that has your desired values: EnvDTE.Configuration类具有一个Properties集合,该集合具有所需的值:
config.Properties.Item("StartProgram").Value config.Properties.Item( “StartProgram中”)。值
config.Properties.Item("StartArguments").Value config.Properties.Item( “StartArguments”)。值
FWIW, the VSLangProj.dll assembly has a VSLangProj.ProjectConfigurationProperties class with the property names that you can expect in the config.Properties collection. FWIW,VSLangProj.dll程序集具有一个VSLangProj.ProjectConfigurationProperties类,该类具有可以在config.Properties集合中期望的属性名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.