Reputation: 2178
I have a netstandard1.2
project with the following project.json
{
"supports": {},
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.2": {}
}
}
This project is included within a Solution which contains .NET Framework projects targeting 4.5.1 (a couple of the other projects reference this netstandard1.2
project, but the project itself does not reference any others).
Everything restores and builds OK in Visual Studio 2015 Update 3 (NuGet 3.5.0) but when the build server (On-premise Build Agent for Team Services, updated to latest 2.105.1) runs the vNext step to restore packages for the solution, I get the error:
Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'.
Things I have done:
Is there anything I am missing or anything I could try?
More detailed output from NuGet:
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
Update: Here is my Nuget.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Upvotes: 0
Views: 2890
Reputation: 29966
I managed to reproduce your issue after clear the nuget cache in my build agent. And the solution to fix this issue is either not specifying the nuget.config file in nuget restore task or adding the nuget package source in nuget.config file.
<?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>
Upvotes: 2