Exclude projects from build on pre-build event

Issue #24 on hold
Former user created an issue

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'.

Comments (7)

  1. Denis Kuzmin repo owner

    yes, thanks, forgot about this :)

    Currently, started #19: Multi Actions (planned on v0.9) and also planned Issue #21 Subcommands

    I think it's more convenient for programmatically checking/unchecking, for example:

    #[(cond){
       #[Build project(<name>).enabled = true|false|1|0]
    }]
    

    + and yes, maybe additional component like a 'Execution Order' (later should be more clear!)

    So, I accepted this Issue and implementation should be later... And you can watch this ticket about progress of this implementation..

    Please remeber: bitbucket.org allows anonymous issue creation, but for new comments you should be authorized for this tracker

    ah ,yes.. what about variant with 'Operation Mode' ? not working ?

        Build.SolutionPlatforms(x86)
        Build.SolutionConfigurations(Debug_Exclude_Plugins_All)
    
  2. Denis Kuzmin repo owner

    This feature has been implemented with a2b482f

    #[Build projects.find("name").IsBuildable = true|false|1|0]
    
    #[Build projects.find("name").IsBuildable]
    
    #[Build projects.find("name").IsDeployable = true|false|1|0]
    
    #[Build projects.find("name").IsDeployable]
    

    Where name it's project name in your solution. Note: BuildComponent working with SolutionContexts, and name should be as:

    • "bzip2.vcxproj"
    • "Zenlib\ZenLib.vcxproj"

    etc.

    However, find() property compares as part of the name, and you can use simply like a find("ZenLib") or for unique identification full "Zenlib\ZenLib.vcxproj"

    Changes planned on v0.9, you also can test this feature before releases. Write here or contact with me, I can release debug version or you can manually test with a2b482f (see - wiki - How to build vsSBE)

    Please note: currently this feature implemented only as part of SBE-Scripts,

    Graphical helper can be later... if needed

  3. Log in to comment