依赖 Microsoft.Composition 1.0.27 不支持框架 .NETCoreApp,Version=v1.1 [英] The dependency Microsoft.Composition 1.0.27 does not support framework .NETCoreApp,Version=v1.1

查看:12
本文介绍了依赖 Microsoft.Composition 1.0.27 不支持框架 .NETCoreApp,Version=v1.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将框架部分升级到:

When I upgrade framework section to:

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

我遇到错误

依赖 Microsoft.Composition 1.0.27 不支持框架.NETCoreApp,版本=v1.1.

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

Microsoft.VisualStudio.Web.CodeGeneration.Tools"

"Microsoft.VisualStudio.Web.CodeGeneration.Tools"

:下划线

推荐答案

Microsoft.Composition 支持 .NET Framework 4.5、Windows 8 和 WindowsPhone 8.1 等目标,这意味着它应该可以工作.

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

但它并没有专门针对 netstandard1.x 也不是 netcoreapp1.x,因此您需要通过导入部分告诉 nuget 来恢复 PCL 库针对以上平台:

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"]
    }
}

portable-net45-win8" 部分告诉它,还可以使用 .NET 4.5 和 Windows 8 目标恢复 PCL,因为它们应该在 99% 的 .NET 情况下工作Core(Windows 运行时基于 System.Runtime,.NET Core 也是,这就是它起作用的原因).

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).

但是永远不要使用import来恢复非PCL或至少不支持win8/wpa8和net45的PCL.

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

要在新的 .csproj 项目结构中做到这一点,您需要添加

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

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

相反.当您确定不使用任何使用其中任何一个的包时,可选择省略 dotnet5.6dnxcore50.

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

这篇关于依赖 Microsoft.Composition 1.0.27 不支持框架 .NETCoreApp,Version=v1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆