I am using Visual Studio 2015 Update 3 and have a *.csproj
portable class library set to target .NETStandard1.x
.
In order to be able to reference Nancy 2.0.0-barneyrubble nuget package, I need to upgrade the portable class library to .NETStandard1.6
. However, doing so renders the project unbuildable.
Any attempt to build it in Visual Studio or using msbuild report this error:
Your project is not referencing the ".NETPlatform,Version=v5.0" framework. Add a reference to ".NETPlatform,Version=v5.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
Here is the project.json
file:
{
"supports": {},
"dependencies": {
"Microsoft.AspNetCore.Owin": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"Nancy": "2.0.0-Pre0",
"NETStandard.Library": "1.6.1"
},
"frameworks": {
"netstandard1.6": {}
}
}
Building the project with dotnet restore
and dotnet build
from the command line works, though.
I know this issue is not specific to Nancy. Yet I'd love to know if somebody found a workaround for this problem. Or if it might be possible to use a lower .NET Standard version when building Nancy itself?
I don't think just using Visual Studio 2015 Update 3 is enough. The dotnet/web tooling for Visual Studio ships out of band, so you need to go get the latest version of that here.
@khellang I had already installed the .NET Core tooling (both command line and Visual Studio 2015 integration). And I can happily build .NET Standard 1.3 class libraries. It is just that I need 1.6 to be able to reference Nancy. And that won't build.
Hmm. Have you looked at this?
Thank you - indeed, adding this to the end of the *.csproj
file did the trick:
<PropertyGroup>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
I wrote a blog post on the topic, just in case.
Most helpful comment
I wrote a blog post on the topic, just in case.