Nuget 安装程序任务在 tfs 2017 构建中失败
Nuget Installer task fails in tfs 2017 builds
我们正在使用 Nuget 安装程序步骤恢复 TFS 构建中丢失的 nuget 包,此步骤失败并出现以下错误:
E:\Builds\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b[=19=].2.29\node_modules\nuget-task-common\NuGet.3.0\NuGet.exe 恢复 -NonInteractive E:\Builds\test.sln
MSBuild 自动检测:使用来自 'C:\Windows\Microsoft.NET\Framework\v3.5' 的 msbuild 版本“3.5”。
解析位于 E:\Builds\test.sln 的解决方案文件时出错:系统找不到指定的文件。 (HRESULT 异常:0x80070002)
错误:E:\Builds\Agent2017Update1_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b[=24=].2.29\node_modules\nuget-task-common\NuGet.3.0\NuGet.exe 失败,代码为 return:1
软件包安装失败
错误消息似乎令人困惑,因为指定的文件存在于构建代理中。
TFS 构建代理 version:2.112.0
TFS 版本:TFS 2017 更新 1
在“高级”选项中,将 NuGet 的版本更改为 3.5。过去 2 周我一直遇到奇怪的问题,其中 3.3 会与您遇到的情况类似,并且切换到 3.5 会按预期工作。
希望这对你也有用 =D
这似乎是因为您的路径(您的构建代理)中的 msbuild.exe
是版本 3.5。 MSBuild 3.5 没有两个 nuget 尝试动态加载的 .dll(Microsoft.Build.dll
和 Microsoft.Build.Framework.dll
)。
A solution to fix this issue, please make sure NuGet.exe uses MSBuild
4.0 or higher. This can be done by making sure MSBuild 4.0 or higher is the first to resolve in your path or by passing the -msbuildversion
option. For example, use MSBuild 14.0 (which shipped with Visual
Studio 2015).
nuget.exe pack MyProj.csproj -msbuildversion 14.0
更多细节请参考这个类似的问题nuget pack fails when MSBuild version resolved to MSBuild 3.5
我们正在使用 Nuget 安装程序步骤恢复 TFS 构建中丢失的 nuget 包,此步骤失败并出现以下错误:
E:\Builds\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b[=19=].2.29\node_modules\nuget-task-common\NuGet.3.0\NuGet.exe 恢复 -NonInteractive E:\Builds\test.sln MSBuild 自动检测:使用来自 'C:\Windows\Microsoft.NET\Framework\v3.5' 的 msbuild 版本“3.5”。 解析位于 E:\Builds\test.sln 的解决方案文件时出错:系统找不到指定的文件。 (HRESULT 异常:0x80070002) 错误:E:\Builds\Agent2017Update1_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b[=24=].2.29\node_modules\nuget-task-common\NuGet.3.0\NuGet.exe 失败,代码为 return:1 软件包安装失败
错误消息似乎令人困惑,因为指定的文件存在于构建代理中。
TFS 构建代理 version:2.112.0 TFS 版本:TFS 2017 更新 1
在“高级”选项中,将 NuGet 的版本更改为 3.5。过去 2 周我一直遇到奇怪的问题,其中 3.3 会与您遇到的情况类似,并且切换到 3.5 会按预期工作。
希望这对你也有用 =D
这似乎是因为您的路径(您的构建代理)中的 msbuild.exe
是版本 3.5。 MSBuild 3.5 没有两个 nuget 尝试动态加载的 .dll(Microsoft.Build.dll
和 Microsoft.Build.Framework.dll
)。
A solution to fix this issue, please make sure NuGet.exe uses MSBuild 4.0 or higher. This can be done by making sure MSBuild 4.0 or higher is the first to resolve in your path or by passing the
-msbuildversion
option. For example, use MSBuild 14.0 (which shipped with Visual Studio 2015).nuget.exe pack MyProj.csproj -msbuildversion 14.0
更多细节请参考这个类似的问题nuget pack fails when MSBuild version resolved to MSBuild 3.5