我有一个netstandard1.2
项目,其中包含以下project.json
{
"supports": {},
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.2": {}
}
}
此项目包含在一个解决方案中,该解决方案包含面向4.5.1的.NET Framework项目(其他几个项目引用此{{1}}项目,但项目本身并未引用任何其他项目。)
在Visual Studio 2015 Update 3(NuGet 3.5.0)中,所有内容都可以恢复和构建,但是当构建服务器(Team Services的内部构建代理,更新到最新的2.105.1)运行vNext步骤以恢复包时解决方案,我收到错误:
无法解析NETStandard.Library(> = 1.6.0)' for .NETStandard,Version = v1.2'。
我做过的事情:
我有什么遗漏或任何我可以尝试的东西吗?
NuGet的更详细输出:
netstandard1.2
更新:这是我的Nuget.Config
2016-09-06T14:28:43.0788201Z ##[debug] C:\BuildAgent\_work\17\s\.nuget\NuGet.Config
2016-09-06T14:28:43.0798020Z [command]D:\nuget.exe restore -NonInteractive C:\BuildAgent\_work\17\s\MySolution.sln -ConfigFile C:\BuildAgent\_work\17\s\.nuget\NuGet.Config
2016-09-06T14:28:43.4458345Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.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\17\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\17\s\MyProject\project.lock.json
2016-09-06T14:28:44.0038195Z C:\BuildAgent\_work\17\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\17\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\17\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
答案 0 :(得分:2)
在我的构建代理中清除nuget缓存后,我设法重现了您的问题。解决此问题的解决方案是在nuget restore任务中未指定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>