Azure DevOps管道如何设置VCVARS64.BAT然后从批处理文件调用msbuild.exe?
在本地机器上,我执行 build.bat 打开 x64本机工具命令提示vs vs for 2019 ,然后 build.bath.bat 调用 call < strong> msbuild.exe 。
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
build.bat
在Azure DevOps管道CMDLine任务中,我该怎么做?
build.bat 呼叫 msbuild.exe 从azure-pipelines.yml cmdline 任务时会失败。
是否有可靠的方法可以找到和调用VCVARS64.BAT,以便找到msbuild.exe?
- task: CmdLine@2
displayName: 'build.bat calls msbuild'
inputs:
script: |
build.bat
Azure管道错误:
2022-05-06T15:42:53.3802703Z 'msbuild' is not recognized as an internal or external command,
2022-05-06T15:42:53.3803010Z operable program or batch file.
事先感谢您的任何提示或方向。
On a local machine, I execute my build.bat after opening a x64 Native Tools Command Prompt for VS 2019, then build.bat calls msbuild.exe.
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
build.bat
How can I do same in an Azure DevOps pipeline CmdLine task?
The build.bat call to msbuild.exe fails when called from azure-pipelines.yml CmdLine task.
Is there a reliable method to locate and call vcvars64.bat so that msbuild.exe can be found?
- task: CmdLine@2
displayName: 'build.bat calls msbuild'
inputs:
script: |
build.bat
Azure pipeline error:
2022-05-06T15:42:53.3802703Z 'msbuild' is not recognized as an internal or external command,
2022-05-06T15:42:53.3803010Z operable program or batch file.
Thanks in advance for any tips or direction.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从我的角度来看,使用批处理文件不在DevOps哲学上。相反,您应该将批处理文件分配到步骤,然后使用适当的DevOps步骤。例如,在MSBUILD的情况下,这是 https://learn.microsoft.com/en-us/azure/devops/pipelines/pasks/tasks/build/msbuild?view= azure-devops
但是,如果您需要直接使用MSBUILD,那么您可以使用与本地env中相同的路径,但是通往VS的路径将取决于您在管道中使用的版本(代理池)
From my point of view, using batch file is out of DevOps philosophy. Instead, you should decompile your batch file to steps and then use appropriate DevOps step. for example, in case of msbuild this is https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/msbuild?view=azure-devops
But if you need to use msbuild directly, then you can use paths same like in your local env, but path to VS will depends on what version (agent pool) you using in your pipeline