当我将框架部分升级到:
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.6 和 dnxcore50.
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
发布评论