我正在将内部部署版本迁移到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工具的位置?
尽管报告的https://stackoverflow.com/a/42140667是为TeamCity而非Azure Devops提供的解决方案,但仍需要指定指向al.exe
的其他路径。我需要在这里做类似的事情吗?
谢谢
答案 0 :(得分:1)
根据日志,似乎您正在使用托管的windows-2019
代理。
默认情况下,NETFX 4.6.1 Tools
代理上未安装windows-2019
。因此它无法在al.exe
下找到"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\al.exe"
文件。有关详细信息,请参见Hosted Windows 2019。
但是NETFX 4.6.1 Tools
已安装在vs2017-win2016
代理上。因此,请尝试使用vs2017-win2016
代理而不是windows-2019
代理。
您可以在管道中运行以下命令以检查安装的版本 每个代理上的NETFX工具的组合:
cd 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin'
dir
因此,要使用最新的windows-2019
代理,您可以尝试直接在[projectname] .csproj文件中指定SDK编辑的路径,添加:
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools</TargetFrameworkSDKToolsDirectory>