MSbuild build order issue - pre-build steps first or dependent projects first

前端 未结 4 1942
日久生厌
日久生厌 2021-02-07 13:42

I have a project A depending on project B. Project A has some pre-build tasks that is dependent of some generated files from project B. When I build in Visual Studio, no probl

4条回答
  •  长情又很酷
    2021-02-07 14:19

    Jack's answer seems to be working, but what I did not like about it is that support for editing the .csproj is not natively supported in the VS UI, other than the awkward "Unload project, Edit project (during which you can't click on your files as you normally would like to), Reload project" model. What I wanted was for the pre-build event to trigger after dependent projects built, and have this work the same in VS as in MSBuild. After struggling with this problem, I found a solution that works for me in MSBuild 4.0.

    No matter what I tried, I could not alter the PreBuildEvents target to trigger after the dependent projects finished building. So what I did instead was to disable the PreBuildEvents target, and create a bastardized custom PreBuildEvents target that would run at the appropriate time:

    
      
        false
      
    
    
    
      
    
    

提交回复
热议问题