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

橙三吉。 提交于 2019-11-30 18:34:09

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!