I would like to activate or deactivate projects when building a solution. Is it possible to setup a solution pre-build event to programmatically deactivate certain projects? In essence, I would like to do the same as if I would manually modify the "Build" checkboxes in the solution configuration properties. The problem that I'm trying to solve is about improving the build time in a C++ solution. In my solution, there are core projects and multiple plugin projects which depend on the core projects. Often, we make changes to core classes which do not change the application binary interface (ABI). In this case, the plugin projects don't have to be rebuilt. However, visual studio often triggers unnecessary rebuilds of files, e.g., when core header files are modified. To overcome this, I want to store a variable for the ABI version of the core projects. Each plugin project also stores the ABI version it has been built with the last time. In the pre-built solution event I want to compare the ABI version of the plugin project with the ABI version of the core. Only if they don't match, I want to build the plugin project (I was thinking to store the ABI version in some header file of the core plugin. Programmers must keep it uptodate). Thus it would be great if it were possible to programmatically deactivate a project in the pre-build event. I have checked the EnvDTE, but I have not yet found a way to accomplish this.
I have posted this issue on the plugins Q&A page and the author of the vsSolutionBuildEvent plugin kindly asked me to create this ticket here. To resolve this issue he suggests:
EnvDTE provides the SolutionContext Interface for getting/setting the buildable flag(IsBuildable) to selected projects. It's possible to do a more detailed configuration of the specific building, it can be implemented in the next versions as a similar window of the 'Execution Order'.