roslyn: PCL does not support targeting .NETStandard 1.6

Version Used: VS 2015 Update 3

Steps to Reproduce:

  1. Create a new PCL
  2. Target netstandard1.6
  3. Build

Expected Behavior: Build succeeds without error

Actual Behavior: Build fails with

Severity Code Description Project File Line Suppression State
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. ClassLibrary3 C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets 140

As @akoeplinger pointed out here https://github.com/dotnet/corefx/issues/10213#issuecomment-235049724 this is due to missing entries in C:\Program Files (x86)\MSBuild\Microsoft\Portable\v5.0\Microsoft.Portable.Common.targets.

Not sure if roslyn is the right repo for PCL bugs but its the only one I’m aware of that is tracked by the folks that own this component.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I added

<PropertyGroup> <NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker> </PropertyGroup>

at the end of my csproj, before the </Project> and after the comment about adding tasks, w/ VS2015.3 and targeting netstandard1.6. It finally compiled for me w/ VS.

You need to do it after the last import statement since PCL overwrites the value of this property.

@prochan2 Try adding <NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker> to the <PropertyGroup> at the top of your .csproj file.

Fixed in RC2.

The workaround doesn’t seem to work for me when running from a TFS (xaml) build. Neither does updating the Microsoft.Portable.Common.targets.

I have this issue today in VS 2015 Update 3 with a PCL targetting .NETStandard1.6

I tried the workaround but no difference, I do not understand @ericstj “You need to do it after the last import statement since PCL overwrites the value of this property.” becuase all my PropertyGroup elements are way above my last Import element - which is near the bottom.

It works, thanks @Pilchie & @ericstj!