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?
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.
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.
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.
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.
You could expand Advanced section, and select latest version of Nuget. As of October 2016 that was Nuget 3.5 rc2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With