Make a target run once at the Solution level in MSBuild

后端 未结 2 2064
一向
一向 2021-02-05 16:20

I need a set of tasks that need to be executed exactly once for the entire solution. This will run tasks that will modify each project to run a separate set of tasks for each pr

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 17:05

    Since Solution files are not in MSBuild format they are not easily extended or customized. If you want more control over the build process you would have to create a "driver" msbuild file which would replace your solution file. Inside this driver file you would build all the projects that you needed and perform some additional tasks. You would do this using the MSBuild task. Here is a sample showing how to build more than 1 project.

    
        
            
            
            
        
    
        
            
        
    
    
    

    So in your case you would just execute the tasks before you build the projects. Also note that I specified the value true for the BuildInParallel indicating that MSBuild can try and build more than one project at once.

提交回复
热议问题