Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Team Services Build Package Restore failing with project.json netstandard1.0 target

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?

like image 653
pianomanjh Avatar asked Jun 30 '16 20:06

pianomanjh


People also ask

How do I restore a package in Visual Studio?

Restore by using MSBuild You can use msbuild -t:restore to restore packages in NuGet 4. x+ and MSBuild 15.1+, which are included with Visual Studio 2017 and higher. This command restores packages in projects that use PackageReference for package references.

How do I restore NuGet in Visual Studio?

To do that, go to Tools, NuGet Packaged Manager, then go to Package Manager Settings. Go to the General section, and then make sure you have a checkmark for Allow NuGet to download missing packages and also to automatically check for missing packages during the build in Visual Studio. So click on OK.

How do I reinstall NuGet package?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

How do I run a dotnet restore in Visual Studio 2019?

In Tools -> Options -> NuGet Package Manager -> General you need to select the "Allow NuGet to download missing packages" option which allows NuGet to restore and the "Automatically check for missing packages during build in Visual Studio" which enables on build restore.


1 Answers

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

like image 113
codevision Avatar answered Sep 25 '22 20:09

codevision