Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The dependency Microsoft.Composition 1.0.27 does not support framework .NETCoreApp,Version=v1.1

When I upgrade framework section to:

"frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
      },
      "imports": "dnxcore50"
    }
  }

I am getting error

The dependency Microsoft.Composition 1.0.27 does not support framework .NETCoreApp,Version=v1.1.

With

"Microsoft.VisualStudio.Web.CodeGeneration.Tools"

: underlined

like image 272
Radenko Zec Avatar asked Nov 28 '16 14:11

Radenko Zec


2 Answers

Microsoft.Composition supports .NET Framework 4.5, Windows 8 and WindowsPhone 8.1 among other targets, this means it should work.

But it doesn't target netstandard1.x specifically neither does it netcoreapp1.x, so you need to tell nuget via the import section to also restore PCL Libraries which target the platforms above:

"frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
      },
      "imports": ["dnxcore50", "portable-net45+win8"]
    }
}

The "portable-net45-win8" part tells it, to also restore PCLs with .NET 4.5 and Windows 8 targets too, as they should work in 99% of all cases with .NET Core (Windows Runtime is based on System.Runtime and .NET Core is too, that's why it works).

But NEVER use import to restore non-PCL or PCL which don't support at least win8/wpa8 and net45.

Update for csproj:

To do that in the new .csproj project structure, you need to add

<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8</PackageTargetFallback>

instead. Optionally leave out dotnet5.6 and dnxcore50 when you're sure you don't use any packages which use any of these.

like image 162
Tseng Avatar answered Oct 31 '22 09:10

Tseng


If you are dealing with csproj files you can edit them and add this line:

<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>

The result should look like this:

<PropertyGroup> <TargetFramework>netcoreapp1.1</TargetFramework> <PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback> </PropertyGroup>

This is how VS converter does it when it upgrades project.json to csproj. If you need other targets, you can play around converting your project.json files to csproj files and see the output.

like image 37
aunoum Avatar answered Oct 31 '22 09:10

aunoum