Mike_G
Mike_G

Reputation: 16502

Upgraded to .Net Standard 2, now project says reference isnt there

I just upgraded a .Net Standard 1.4 PCL dll to .Net Standard 2.0. I am trying to write a method that returns a ValueTuple and I get the error:

Cannot define a class or member that utilizes tuples because the compiler required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found. Are you missing a reference?

But it is...kind of. Below is what my project.json says:

{
  "supports": {},
  "dependencies": {
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "NETStandard.Library": "2.0.0",
    "Newtonsoft.Json": "10.0.3",
    "System.Collections.Specialized": "4.3.0",
    "System.ComponentModel.Annotations": "4.4.0",
    "System.Net.Http": "4.3.2",
    "System.Reflection": "4.3.0",
    "System.Runtime.Serialization.Primitives": "4.3.0",
    "System.ServiceModel.Primitives": "4.4.0",
    "System.ValueTuple": "4.4.0"
  },
  "frameworks": {
    "netstandard2.0": {}
  }
}

But when I expand my references for the project, I notice a couple packages aren't listed.

enter image description here

Ive tried this answer with no success.

edit: I am using VS 2017

Upvotes: 1

Views: 508

Answers (2)

Mike_G
Mike_G

Reputation: 16502

I couldn't get around this SNAFU so I ended up just creating a brand new project based on .net standard 2.0. Copied all my files over to the new project and added it as a reference to all my projects. It trashed my resharper, but everything else works.

Upvotes: 2

vaindil
vaindil

Reputation: 7844

I just had this problem as well. Turns out my .csproj file had the lines below, even though the version referenced was .NET Core 2.0. I removed these lines and the project built successfully.

<RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>

Upvotes: 1

Related Questions