Search code examples
c#visual-studioscriptingvcxproj

I need to get the output file of a vcxproj programatically using c#


I know that I can look into properties,TargetPath, TargetDir, TargetFileName, by right clicking on a project and checking out it's properties but I need to do this programatically. Any help would be very much appreciated.


Solution

  • You can get such properties (using the selected startup project as an example) starting with the following code:

    Project startupProject = DTE.Solution.Item(((DTE.Solution.SolutionBuild as SolutionBuild2).StartupProjects as object[])[0]);
    Properties p = startupProject.ConfigurationManager.ActiveConfiguration.Properties;