Nuget 无法在 VS Team Services 的构建代理构建中为 netstandard1.2 恢复 NetStandard.Libary
Nuget fails to restore NetStandard.Libary for netstandard1.2 in Build Agent build for VS Team Services
我有一个 netstandard1.2
项目,其中 project.json
{
"supports": {},
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.2": {}
}
}
此项目包含在一个解决方案中,该解决方案包含针对 4.5.1 的 .NET Framework 项目(其他几个项目引用此 netstandard1.2
项目,但项目本身不引用任何其他项目)。
在 Visual Studio 2015 Update 3 (NuGet 3.5.0) 中一切都恢复并构建正常,但是当构建服务器(团队服务的本地构建代理,更新到最新的 2.105.1)运行 vNext步骤恢复解决方案的包,我收到错误:
Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'.
我做过的事情:
- Visual Studio 构建服务器上的 2015 是最新的更新 3
- .Net Core 预览工具已安装在构建服务器上
- 构建服务器上有最新的 NuGet
- vNext 构建中的 NuGet 恢复步骤指向最新的 NuGet(而不是 Team Services 构建代理附带的 v3.3.0)
- 使用构建器服务器上安装的 Visual Studio 2015 成功构建解决方案(VS 安装了 NuGet 3.5.0 扩展)
有什么我遗漏的或我可以尝试的吗?
更详细的 NuGet 输出:
2016-09-06T14:28:43.0788201Z ##[debug] C:\BuildAgent\_work\s\.nuget\NuGet.Config
2016-09-06T14:28:43.0798020Z [command]D:\nuget.exe restore -NonInteractive C:\BuildAgent\_work\s\MySolution.sln -ConfigFile C:\BuildAgent\_work\s\.nuget\NuGet.Config
2016-09-06T14:28:43.4458345Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild.0\bin'.
2016-09-06T14:28:43.8138208Z All packages listed in packages.config are already installed.
2016-09-06T14:28:43.8618591Z Restoring packages for C:\BuildAgent\_work\s\MyProject\project.json...
2016-09-06T14:28:43.9588089Z Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'.
2016-09-06T14:28:43.9848100Z Committing restore...
2016-09-06T14:28:43.9898096Z Writing lock file to disk. Path: C:\BuildAgent\_work\s\MyProject\project.lock.json
2016-09-06T14:28:44.0038195Z C:\BuildAgent\_work\s\MyProject\MyProject.csproj
2016-09-06T14:28:44.0048116Z Restore failed in 163ms.
2016-09-06T14:28:44.0108191Z Errors in C:\BuildAgent\_work\s\MyProject\MyProject.csproj
2016-09-06T14:28:44.0108191Z Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'.
2016-09-06T14:28:44.0118109Z NuGet Config files used:
2016-09-06T14:28:44.0118109Z C:\BuildAgent\_work\s\.nuget\NuGet.Config
2016-09-06T14:28:44.0268561Z ##[debug]rc:1
2016-09-06T14:28:44.0278115Z ##[debug]success:false
2016-09-06T14:28:44.0288120Z ##[error]Error: D:\nuget.exe failed with return code: 1
2016-09-06T14:28:44.0298129Z ##[error]Packages failed to install
更新:这是我的Nuget.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
清除构建代理中的 nuget 缓存后,我成功重现了您的问题。解决此问题的方法是不在 nuget 还原任务中指定 nuget.config 文件,或者在 nuget.config 文件中添加 nuget 包源。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
我有一个 netstandard1.2
项目,其中 project.json
{
"supports": {},
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.2": {}
}
}
此项目包含在一个解决方案中,该解决方案包含针对 4.5.1 的 .NET Framework 项目(其他几个项目引用此 netstandard1.2
项目,但项目本身不引用任何其他项目)。
在 Visual Studio 2015 Update 3 (NuGet 3.5.0) 中一切都恢复并构建正常,但是当构建服务器(团队服务的本地构建代理,更新到最新的 2.105.1)运行 vNext步骤恢复解决方案的包,我收到错误:
Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'.
我做过的事情:
- Visual Studio 构建服务器上的 2015 是最新的更新 3
- .Net Core 预览工具已安装在构建服务器上
- 构建服务器上有最新的 NuGet
- vNext 构建中的 NuGet 恢复步骤指向最新的 NuGet(而不是 Team Services 构建代理附带的 v3.3.0)
- 使用构建器服务器上安装的 Visual Studio 2015 成功构建解决方案(VS 安装了 NuGet 3.5.0 扩展)
有什么我遗漏的或我可以尝试的吗?
更详细的 NuGet 输出:
2016-09-06T14:28:43.0788201Z ##[debug] C:\BuildAgent\_work\s\.nuget\NuGet.Config
2016-09-06T14:28:43.0798020Z [command]D:\nuget.exe restore -NonInteractive C:\BuildAgent\_work\s\MySolution.sln -ConfigFile C:\BuildAgent\_work\s\.nuget\NuGet.Config
2016-09-06T14:28:43.4458345Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild.0\bin'.
2016-09-06T14:28:43.8138208Z All packages listed in packages.config are already installed.
2016-09-06T14:28:43.8618591Z Restoring packages for C:\BuildAgent\_work\s\MyProject\project.json...
2016-09-06T14:28:43.9588089Z Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'.
2016-09-06T14:28:43.9848100Z Committing restore...
2016-09-06T14:28:43.9898096Z Writing lock file to disk. Path: C:\BuildAgent\_work\s\MyProject\project.lock.json
2016-09-06T14:28:44.0038195Z C:\BuildAgent\_work\s\MyProject\MyProject.csproj
2016-09-06T14:28:44.0048116Z Restore failed in 163ms.
2016-09-06T14:28:44.0108191Z Errors in C:\BuildAgent\_work\s\MyProject\MyProject.csproj
2016-09-06T14:28:44.0108191Z Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'.
2016-09-06T14:28:44.0118109Z NuGet Config files used:
2016-09-06T14:28:44.0118109Z C:\BuildAgent\_work\s\.nuget\NuGet.Config
2016-09-06T14:28:44.0268561Z ##[debug]rc:1
2016-09-06T14:28:44.0278115Z ##[debug]success:false
2016-09-06T14:28:44.0288120Z ##[error]Error: D:\nuget.exe failed with return code: 1
2016-09-06T14:28:44.0298129Z ##[error]Packages failed to install
更新:这是我的Nuget.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
清除构建代理中的 nuget 缓存后,我成功重现了您的问题。解决此问题的方法是不在 nuget 还原任务中指定 nuget.config 文件,或者在 nuget.config 文件中添加 nuget 包源。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>