0

enter image description here

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. 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.

1 Answer 1

1

The EnvDTE.Configuration class has a Properties collection that has your desired values:

config.Properties.Item("StartProgram").Value

config.Properties.Item("StartArguments").Value

FWIW, the VSLangProj.dll assembly has a VSLangProj.ProjectConfigurationProperties class with the property names that you can expect in the config.Properties collection.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.