答案 0 :(得分:1)
Nancy在github上的主分支已经在.net core上运行了。我们正在从Rake转向Cake来构建脚本,希望本周将其包装起来所以.netcore支持可以推送到Nuget.So是等待一点。
答案 1 :(得分:1)
此示例是在Stack Overflow Documentation上编写的原始文档:
Prerequiste步骤:
mkdir nancydotnetcore cd nancydotnetcore mkdir src mkdir test touch global.json
{ "projects":["src", "test"] }
cd src mkdir NancyProject1 dotnet new在VS代码中打开文件夹NancyProject1 您将收到一条警告:“'nancyproject1'中缺少构建和调试所需的资产。” 点击“是” 您还会看到:'project.json'存在未解析的依赖项。请执行restore命令继续。 点击“关闭”我们很快就会到达。
{ "version": "1.0.0-*", "buildOptions": { "debugType": "portable", "emitEntryPoint": true }, "frameworks": { "netcoreapp1.1": { "dependencies": { "Microsoft.AspNetCore.Hosting": "1.1.0", "Microsoft.AspNetCore.Server.Kestrel": "1.1.0", "Microsoft.AspNetCore.Owin": "1.1.0", "Nancy": "2.0.0-barneyrubble", "Microsoft.NETCore.App": { "type": "platform", "version": "1.1.0" } } } } }VS代码将要求恢复点击“恢复”
namespace NancyProject1 { using Nancy; public class IndexModule : NancyModule { public IndexModule() { Get("/", _ => "Hello dotnet core world!"); } } }
namespace NancyProject1 { using Microsoft.AspNetCore.Builder; using Nancy.Owin; public class Startup { public void Configure(IApplicationBuilder app) { app.UseOwin(x => x.UseNancy()); } } }
namespace NancyProject1 { using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseContentRoot(Directory.GetCurrentDirectory()) .UseKestrel() .UseStartup() .Build(); host.Run(); } } }
仍然是预发布版本,但在撰写本文时,使用.net核心,视图引擎在核心上非常有限。
答案 2 :(得分:0)
安装包Nancy -Version 2.0.0-barneyrubble -Pre