Ravid Goldenberg
Ravid Goldenberg

Reputation: 2299

In a visual studio extension identifying if the solution is opened in release or debug

I am trying to create a VS extension that will automate some of the repetitive work done by hand when building a new version of a project (like moving .MSI files around and stuff like that). I wish for the extension to different things based on the solution configuration debug/release status.

In simple terms - If the user is working on a solution in debug configuration and than presses my extension button it will do something different than if he is working on a release configuration. The question is, how can I while in the extension context identify the working configuration of the solution?

any leads will be appreciated.

Upvotes: 1

Views: 276

Answers (1)

Stephan Bauer
Stephan Bauer

Reputation: 9249

I think you are looking for SolutionConfiguration2:

DTE dte = (DTE)ServiceProvider.GetService(typeof(DTE));
SolutionBuild builder = dte.Application.Solution.SolutionBuild;
SolutionConfiguration2 config = (SolutionConfiguration2)builder.ActiveConfiguration;

The MSDN page also contains an example how to read the needed properties

Upvotes: 2

Related Questions