【发布时间】:2019-12-30 12:15:55
【问题描述】:
我正在将本地构建迁移到 Azure Devops。我正在使用默认的 Azure 构建代理,没有在默认代理配置上指定任何内容。
这是构建管道 YAML 中引发错误的部分:
- task: NuGetCommand@2
displayName: 'Build Assemblies: Restore'
inputs:
command: 'restore'
restoreSolution: '$(FooSolutionSolution)'
feedsToUse: 'config'
- task: VSBuild@1
displayName: 'Build Assemblies: Run'
inputs:
solution: '$(FooSolutionSolution)'
platform: '$(FooSolutionBuildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArgs: '-t:rebuild'
它使用标准的 Microsoft.Common.CurrentVersion.targets 文件,但找不到 al.exe。
CoreCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn\vbc.exe /noconfig /imports: {..imports..} /optioncompare:Binary /optionexplicit+ /optionstrict+ /optioninfer+ /nostdlib /platform:AnyCPU /rootnamespace:FooCorp.Central /sdkpath:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1" /highentropyva+ /define:"CONFIG=\"Release\",TRACE=-1,_MyType=\"Windows\",PLATFORM=\"x64\"" /reference: {..references ..} /main:"FooCorp.Central.(None)" /debug- /keyfile:d:\a\1\s\Builds\FooCorpKey\FooCorpKey.snk /optimize+ /out:.\obj\x64\Release\FooSolution\FooCorp.Central.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /resource:.{..resources..} /target:library /warnaserror+ /utf8output /langversion:14 AssemblyInfo.vb {..all other vb files..} "C:\Users\VssAdministrator\AppData\Local\Temp\.NETFramework,Version=v4.5.1.AssemblyAttributes.vb"
Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn
GenerateSatelliteAssemblies:
Creating directory ".\obj\x64\Release\FooSolution\es".
Creating directory ".\obj\x64\Release\FooSolution\ru".
Creating directory ".\obj\x64\Release\FooSolution\zh-CN".
Creating directory ".\obj\x64\Release\FooSolution\lb-LU".
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3639,5):
Error MSB6004: The specified task executable location "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\al.exe" is invalid.
这是我认为我无法控制的事情。
为了比较,当我从命令行本地运行构建时,构建的同一部分的输出是:
GenerateSatelliteAssemblies:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\al.exe /culture:zh-CN /keyfile:C:\s-gl\Builds\FooCorpKey\FooCorpKey.snk /out:.\obj\x64\Release\FooSolution\zh-CN\FooCorp.Central.Lic.resources.dll /platform:AnyCPU /template:.\obj\x64\Release\FooSolution\FooCorp.Central.Lic.dll /embed:.\obj\x64\Release\FooSolution\FooCorp.Central.Lic.a1.zh-CN.resources /embed:.\obj\x64\Release\FooSolution\FooCorp.Central.Lic.a2.zh-CN.resources /embed:.\obj\x64\Release\FooSolution\FooCorp.Central.Lic.a3.zh-CN.resources
由于构建代理由 Azure 提供,我有什么方法可以确定 SDK 工具的位置?
尽管针对 TeamCity 而不是 Azure Devops 报告了 https://stackoverflow.com/a/42140667,但解决方案是为 al.exe 指定不同的路径。我需要在这里做类似的事情吗?
谢谢
【问题讨论】:
-
这似乎是一个托管代理问题。根据日志,您似乎正在使用托管的
windows-2019代理,请尝试使用vs2017-win2016并检查是否有效。此外,您还可以尝试在本地开发机器上setup a private agent,然后使用此私有代理运行构建以检查是否有效。 -
@AndyLi-MSFT 为什么使用较旧的构建代理 (
vs2017-win2016) 会有所帮助?仅供参考,我试过了,它解决了这些错误,但暴露了其他错误。我这里的问题是为什么msbuild在构建代理上找不到al.exe的最新版本?
标签: msbuild azure-devops azure-pipelines al.exe