2016-09-25 66 views
2

我试图让NancyFx在Ubuntu和Windows下运行.Net Core,但是我得到的消息是NancyFx与.NetCoreApp不兼容。 我是新来的整个.NET核心的东西,所以任何帮助是值得欢迎的。NancyFx与.Net Core不兼容

我project.json

{ 
    "version": "1.0.0-*", 
    "buildOptions": { 
    "emitEntryPoint": true 
    }, 

    "dependencies": { 
     "Microsoft.NETCore.App": "1.0.1", 
     "Nancy": "2.0.0-barneyrubble" 
    }, 

    "frameworks": { 
    "netcoreapp1.0": { 
     "imports": "dnxcore50" 
    } 
    } 
} 

上DOTNET错误消息恢复

 
Errors in D:\User\Documents\Visual Studio 2015\Projects\WebService\src\WebService\project.json 
    Package Nancy 2.0.0-barneyrubble is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Nancy 2.0. 
0-barneyrubble supports: 
     - net452 (.NETFramework,Version=v4.5.2) 
     - netstandard1.6 (.NETStandard,Version=v1.6) 
    One or more packages are incompatible with .NETCoreApp,Version=v1.0. 
dotnet --version 
1.0.0-preview2-003131 

有几个教程围绕显示.Net的核心使用南希的人,所以我在干嘛有问题?

+0

你有可能运行'dotnet --version'来确定你使用哪个CLI版本? – Pinpoint

+0

您使用的是网络标准1.0。您应该使用1.6 – Phill

+0

更新到最新的.net CLI(1.0.0-preview2-003131),它将起作用。 –

回答

2

我找到了答案。问题是Microsoft.NETCore.App依赖项中缺少的类型。

{ 
    "version": "1.0.0-*", 
    "buildOptions": { 
    "emitEntryPoint": true 
    }, 

    "dependencies": { 
     "Microsoft.NETCore.App": { 
      "version": "1.0.1", 
      "type": "platform" 
     }, 
     "Nancy": "2.0.0-barneyrubble" 
    }, 

    "frameworks": { 
    "netcoreapp1.0": { 
     "imports": "dnxcore50" 
    } 
    } 
} 

在Windows和Linux上完美构建。