Thomas Koelle
Thomas Koelle

Reputation: 3742

How to resolve error: The targets of Portable Library project are not the same or compatible with the targets of the current Portable Library project

Steps to reproduce VS2015 community edition, then make a solution with two projects, both are "C# Classlibrary (Portable)

Both projects have these two targets:

My problem is that when I try to do solution references from one project to the other then I get the error:

The targets of Portable Library project are not the same or compatible with the targets of the current Portable Library project

I assume it must be something obvious.

Upvotes: 0

Views: 1124

Answers (2)

quanben
quanben

Reputation: 61

This occurs in VS2017 too, may need a separate ticket for it. a miserable bug from MS. The above solution also works for me in VS2017. all that's needed is that the framework part be temporarily replaced by "frameworks": { "netstandard1.4": {} } when a supposedly compatible library is being added to the project. It can be restored to whatever it was after the addition though. This seems the only post on the internet regarding this issue. I need to take note of it as well lest I forget.

Upvotes: 1

Thomas Koelle
Thomas Koelle

Reputation: 3742

This is a workaround, but at least it works for me to run against the standard library instead.

{
  "supports": {},
  "dependencies": {
    "NETStandard.Library": "1.6.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0"
  },
  "frameworks": {
    "netstandard1.4": {}
  }
}

Upvotes: 0

Related Questions