0
votes

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:

  • Visual Studio 2015 on the build server is up-to-date to Update 3
  • .Net Core preview tooling is installed on the build server
  • Latest NuGet is on the build server
  • NuGet restore step in the vNext build is pointing at the latest NuGet (rather than v3.3.0 which is shipped with the Team Services build agent)
  • Successfully build the solution using the Visual Studio 2015 installed on the builder server (VS had NuGet 3.5.0 extension installed)

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>
1
Do you have tried restore the package without the vNext steps? Please restore with the Visual Studio on builder agent for VSO directly, which could help us confirm whether this issue caused by the Visual Studio environment or vNext steps.Weiwei
@Wendy Yes, building in the VS installed on the builder server (which has the VSO build agent on) works OK (The VS installed has NuGet 3.5.0 extension)oatsoda
I cannot reproduce the issue, can you share the settings in the NuGet.Config file you specified in the restore task?Eddie Chen - MSFT
@Eddie-MSFT Updated with NuGet.config now.oatsoda
No package source include in it?Eddie Chen - MSFT

1 Answers

2
votes

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>