Once you set up a .NET Standard csproj according to the instructions here by @dsplaisted, the UI has an option to target netstandard1.6. 1.0 to 1.5 works fine, but as soon as you target netstandard1.6 you are instructed to add the target framework .NETPlatform,Version=v5.0. As soon as you do, Microsoft.NETCore.Portable.Compatibility stops working. Upgrading Microsoft.NETCore.Portable.Compatibility to 1.0.1 does not help.
I've been stuck on this for weeks, but after searching long enough I began to comprehend some of the mechanics (still very foggy) and it turns out I can get it to stop complaining using this:
"frameworks": {
"netstandard1.6": {},
".NETPlatform,Version=v5.0": {
"imports": [ "netstandard1.0" ] // Or "netstandard1.6", or ".NETCore,Version=v5.0"
}
}
Problems:
netstandard1.6 or .NETPlatform,Version=v5.0?This experience is broken; if the tool allows you to change to 1.6 it should do the extra work. Hopefully this will be resolved by the time the tools RTM. I don't really care about tooling but I look to it as a guide when other documentation is lacking.
This does not work:
"frameworks": {
"netstandard1.6": {
"imports": [ ".NETPlatform,Version=v5.0" ]
}
}
This works, but it feels wrong. The fact that I had to import netstandard1.6 seems to mean that .NETPlatform,Version=v5.0 is too loose of a target for my output DLL:
"frameworks": {
".NETPlatform,Version=v5.0": {
"imports": [ "netstandard1.6" ]
}
}
Again, the significance of .NETPlatform,Version=v5.0 vs netstandard1.6 is all very foggy to me and perhaps that last snippet is really ideal, I don't know.
Ping @ericstj . Did this package get broken?
I'm having exactly the same issue.
Create a PCL project, target netstandard 1.6. Project now fails to build in Visual Studio.
It can still build from the command line with dotnet build.
Ping @ericstj . Did this package get broken?
Nothing has changed.
but as soon as you target netstandard1.6 you are instructed to add the target framework .NETPlatform,Version=v5.0
Create a PCL project, target netstandard 1.6. Project now fails to build in Visual Studio.
It can still build from the command line with dotnet build.
That sounds to me like something is wrong with either the CSProj or the PCL targets. For the former, please share the CSproj. For the later, let us know what version of VS Updates you are using.
This is because C:\Program Files (x86)\MSBuild\Microsoft\Portable\v5.0\Microsoft.Portable.Common.targets is missing an entry for .NETStandard,Version=v1.6 in the NuGetTargetMoniker property.
@rchande that needs to be fixed.
@akoeplinger Thanks for looking in to what is causing this!
Thanks @akoeplinger!
@jnm2 @bl4ckhand You should be able to fix this if you add <NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker> to your csproj.
@rchande I can put that in any PropertyGroup?
@jnm2 yep--just use an unconditional one.
Actually, it has to be after the last import in the project since it look like the PCL targets will overwrite it.
I've opened https://github.com/dotnet/roslyn/issues/12918, closing this.
Most helpful comment
This is because
C:\Program Files (x86)\MSBuild\Microsoft\Portable\v5.0\Microsoft.Portable.Common.targetsis missing an entry for.NETStandard,Version=v1.6in the NuGetTargetMoniker property.