5
votes

I have recently updated my portable class libraries to target .NET Core, using project.json, and the new netstandard1.0 framework moniker. My understanding is that this is supported now in Nuget 3.4. I have the following project.json for my project:

{
  "supports": {},
  "dependencies": {
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "NETStandard.Library": "1.6.0"
  },
  "frameworks": {
    "netstandard1.0": {}
  }
}

This builds great from Visual Studio 2015 Update 3.

However, when using VSTS (was Visual Studio Online) build, it now gives me the following error during the Package Restore step:

The project 'MyProject' does not specify any target frameworks in 'C:\a\1\s\MyProject\project.json'.

The command it shows executing is:

NuGet.exe restore "C:\a\1\s\Build.sln"  -NonInteractive -configfile "C:\a\1\NuGet\newNuGet.config"

Is this due to executing restore against a solution? Or perhaps VSTS Build task is not yet using Nuget 3.4?

2
@EricLiu NETStandard.Library 1.6.0 is the only release version of NETStandard.Library on NuGet. It's fine to depend on that even if you're using a lower version of netstandard.svick
I should mention that this is the project.json that was created by Visual Studio 2015 Update 3 after choosing the new "Target Net Standard Library" link in Project Properties. I would be surprised if it was incorrect...pianomanjh
@EricLiu Yes, but that one is also perfectly fine for netstandard1.0 projects. The release version != the target framework version. (It's silly that they look the same)Nate Barbettini

2 Answers

4
votes

You could expand Advanced section, and select latest version of Nuget. As of October 2016 that was Nuget 3.5 rc2

1
votes

I believe it has been resolved already and you use the valid version of NuGet, but you can also add a command line as a new build step, just after the NuGet Installer, and invoke dotnet restore (Tool: dotnet, Arguments: restore).