Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the Debug properties of Visual Studio project programmatically by EnvDTE

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

Screenshot of the properties

like image 497
Lukas Pirkl Avatar asked Jul 29 '14 16:07

Lukas Pirkl


People also ask

How do I change Visual Studio project Properties code?

You access project properties by right-clicking the project node in Solution Explorer and choosing Properties, or by typing properties into the search box on the menu bar and choosing Properties Window from the results. . NET projects might also have a properties node in the project tree itself.

How do I change the project type in Visual Studio?

In the Solutions Explorer window, right-click the exe project and then select Properties in the popup. Then change the Output type from Windows Application to Class Library.

How do I view properties in Visual Studio?

You can find Properties Window on the View menu. You can also open it by pressing F4 or by typing Properties in the search box. The Properties window displays different types of editing fields, depending on the needs of a particular property.


1 Answers

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

like image 168
romanoza Avatar answered Sep 20 '22 23:09

romanoza