问题
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
回答1:
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";
The list of property names is here: http://msdn.microsoft.com/en-us/library/aa984055(v=vs.71).aspx
来源:https://stackoverflow.com/questions/25020255/change-the-debug-properties-of-visual-studio-project-programmatically-by-envdte