Can I build multiple configurations of a project within one solution configuration?

后端 未结 1 1904
南方客
南方客 2021-02-14 13:39

I would like to build the same project twice in the same solution configuration, varying some #define flags to toggle features. Both binaries will be deployed with different na

1条回答
  •  鱼传尺愫
    2021-02-14 14:12

    Just figured out a way to do what you asked for. Create one msbuild file (I named mine multiple.proj) and add the script below.

    
    
      
        
          
            
              Configuration=Release
            
          
        
      
      
        
      
      
        
      
    
    
    
    
    

    Import the script on your projects (csproj or vbproj):

    
    

    This script tells msbuild to build again your project with another configuration as an AfterBuild event. I used Debug/Release to make the example, but you can easily change the script to support other configurations, or make the decision to build again based on other variables.

    Be careful because you're running two builds at once, so build errors can be harder to understand.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题