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

前端 未结 4 1944
日久生厌
日久生厌 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:23

    Short answer

    Remove your build event, and add something like the following to your project (.csproj):

    
      
    
    

    More info

    You can read about customising the build process here: http://msdn.microsoft.com/en-us/library/ms366724%28v=vs.110%29.aspx

    The Before Build event is fired before ResolveReferences, so if the project you reference has not already been built by the time it comes to your project's BeforeBuild event, then your BeforeBuild event will fail.

    To overcome this, you should use a different entry point to customize the build process. In the above example, I use AfterResolveReferences, since this will ensure that all projects which you reference are already built.

提交回复
热议问题