Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

SolutionContext.ConfigurationName set returns E_FAIL

$
0
0
I have the following code in a custom project based on MPF for Projects - Visual Studio 2010:
EnvDTE.Project dteProj = CurrentProject();
dteProj.ConfigurationManager.AddConfigurationRow("MyCustomConfig", "Debug", false);
var solution = dteProj.DTE.Solution as EnvDTE90.Solution3;
foreach (EnvDTE80.SolutionConfiguration2 solConfig in solution.SolutionBuild.SolutionConfigurations)
{
  foreach (EnvDTE.SolutionContext solContext in solConfig.SolutionContexts)
  {
    if (dteProj.UniqueName != solContext.ProjectName)
      continue;

    //Returns E_FAIL 
    solContext.ConfigurationName = "MyCustomConfig";
  }
}

As you can see everything is pretty straight forward. I create a new configuration for my project and want to use it in a solution context. Setting the configuration name returns E_FAIL.

Why is the assignment failing? What is the correct programmatic equivalent for selecting a project configuration for a project from the drop down in the Configuration Manager dialog box?

Thanks



Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>