Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7686583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:30:49+00:00 2026-05-31T19:30:49+00:00

I am working on a small Visual Studio extension that acts on projects in

  • 0

I am working on a small Visual Studio extension that acts on projects in a solution based on if they are set to build in the active build configuration or not. The problem I am having is that I cannot figure out how to determine what those projects are.

I have implemented IVsUpdateSolutionEvents, in which I implement OnActiveProjectCfgChange. I can get Visual Studio to enter the code block when I change configurations, and I have been able to get it to do many of the things that I would like to do, but without being able to determine what projects should be built in the active configuration, I am dead in the water.

My implementation so far is:

public int OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy)
{

    var activeProjects = new HashSet<string>(); // TODO: Get projects in active configuration
    foreach (Project project in _dte.Solution.Projects)
    {
        if (project.Kind != "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" // C#
            && project.Kind != "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}" // VB
            && project.Kind != "{13B7A3EE-4614-11D3-9BC7-00C04F79DE25}" // VSA
           )
            continue;

        IVsHierarchy projectHierarchy;
        _solutionService.GetProjectOfUniqueName(project.UniqueName, out projectHierarchy);
        if (activeProjects.Contains(project.UniqueName))
        {
            // Project is to be built
        }
        else
        {
            // Project is not to be built
        }

        return VSConstants.S_OK;
    }
}

What I need to do is figure out how to fill in the HashSet at the beginning of the function. (Marked with TODO). I have searched and searched, but I have not found what I need.

Does anybody have any references to documentation or sample code that might help me move forward?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:30:50+00:00Added an answer on May 31, 2026 at 7:30 pm

    You can use SolutionContext.ShouldBuild property

     foreach (SolutionContext solutionContext in _applicationObject.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts)
     {
         if (solutionContext.ShouldBuild)
          activeProjects.Add(solutionContext.ProjectName);
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a small web application using Visual Studio 2008 Express. I'm
I have made a small windows application with visual studio 2008 ,its working properly
I've been quite used to working on small projects which I coded with 1,000
Im working on a small application to try out an idea that I have.
For a small project that I'm working on I need to create a Windows
i have just started using visual studio 2008.I am working on c#. I want
I have created a VSTO visual studio application in Visual Studio 2008. It's working
Im working on a small graphics engine project that and I want to it
I'm working on a solution that has a couple DLLS meant for the GAC.
I have been having an issue with Visual Studio 2010 that is driving me

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.