问题描述
我想使用Jenkins的MSbuild来构建多个项目.是否有可能?也许使用分号来分隔项目,如下所示:
I want to use Jenkins's MSbuild to build multiple project. Is it possible? Maybe use semicolons to separate projects, like below:
推荐答案
那行不通.但是您可以为每个项目添加另一个MSBuild-Step.
That doesn't work that way. But you could add another MSBuild-Step for each project.
如果您不想每次都重复'Command Line Arguments',则一种解决方案是检查将构建变量作为属性传递".然后在'Buildenvironment'中选择'将环境变量注入到构建过程中,然后在'Properties Content'中添加类似BUILD_ARGS="/t:rebuild ..."
的内容,然后将${BUILD_ARGS}
(或%BUILD_ARGS%
)添加到命令行参数"
If you don't want to repeat the 'Command Line Arguments' every time one solution could be to check the 'Pass build variables as properties' . Then in 'Buildenvironment' you choose 'Inject environment variables to the build process' and add something like BUILD_ARGS="/t:rebuild ..."
to 'Properties Content' and add ${BUILD_ARGS}
(or %BUILD_ARGS%
) to 'Command Line Arguments'
如果您只想通过一个构建步骤来管理一项工作,则可以使用 Windows批处理文件构建步骤来完成.例如:
If you want to manage only one job with one build step, you can do this by using a Windows batch-file build-step. For example:
set BUILD_ARGS="/t:rebuild /p:VisualStudioVersion=11"
msbuild projectA.sln %BUILD_ARGS%
msbuild projectB.sln %BUILD_ARGS%
在这种情况下,通常必须首先调用类似call "C:\<path-to-your-visual-studio-ins>\VC\vcvars.bat"
之类的东西,具体取决于所需的构建环境.
另外,您可能要处理错误.因此,您可以在每行msbuild
之后添加IF %ERRORLEVEL% NEQ 0 GOTO :eof
.
In this case, you usually have to call something like call "C:\<path-to-your-visual-studio-ins>\VC\vcvars.bat"
initially, depending on your required build environment.
Also, you may want to handle errors. Therefore you could add for example IF %ERRORLEVEL% NEQ 0 GOTO :eof
after each msbuild
line.
这篇关于Jenkins MSbuild多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!