在不使用项目参考的情况下设置构建顺序 [英] Set build order without using project reference

查看:100
本文介绍了在不使用项目参考的情况下设置构建顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的解决方案中,我们有150多个项目,现在大多数项目使用的是.js文件,该文件是由另一个项目生成的.因此,我需要先构建这个项目.我知道我可以将其他项目设置为引用该项目,但是问题是我们有将近100个需要这些.js文件的项目,将这个项目作为参考项目添加到100个项目中并不是最好的选择.

In our solution we have more than 150 projects, now most of projects are using some .js file, which is generated by another project. So I need build this project before others. I know I can set the other projects are reference this project, but the problem is that we have nearly 100 projects that needs those .js file, add this project as reference project to 100 projects is not the best option.

那么,如何在不添加项目参考的情况下设置构建顺序?

So how can I set the build order without adding project reference?

谢谢您的建议.

推荐答案

如何在不添加项目参考的情况下设置构建顺序?

how can I set build order without adding project reference?

您不想为这100个项目中的每个项目设置项目引用或项目依赖项,但是没有可以一次设置多个引用的选项.

You do not want to set project reference or project dependencies to each of those 100 projects, but there is no such option that you can set multiple references at once.

要解决此问题,我想为您提供两种解决方法.

To resolve this problem, I would like provide you two workarounds.

  • 首先构建引用的项目,然后构建解决方案.

  • Build that referenced project first, then build the solution.

这样,您应该注意首先手动构建引用的项目.看来您不是独立开发人员,所以这不是最佳选择.

In this way, you should pay a attention to manually build the referenced project first. It seems you are not independent developer, this way should not the best option.

使用批处理文件设置构建顺序.

Using batch file to set the build order.

您可以使用批处理文件设置构建顺序,首先构建引用的项目,然后构建解决方案:

You can use batch file to set build order, build the referenced project first, then build the solution:

    @echo OFF 
    call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
    echo "Starting Build for all Projects with proposed changes"
    MSBuild.exe "C:\Users\Admin\Source\repos\TestMSBuildOrder\GenerateJSFileProject\GenerateJSFileProject.csproj"
    MSBuild.exe "C:\Users\Admin\Source\repos\TestMSBuildOrder\TestMSBuildOrder.sln"
    pause
    echo "All builds completed." 

希望这会有所帮助.

这篇关于在不使用项目参考的情况下设置构建顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆