我正在尝试使用dotnet CLI编译和运行干净的ASP.NET Core WebAPI,同时使用Windows和OS X.
我试过的......
-
创建了新的ASP.NET 5 WebAPI使用(Yeoman with generator-aspnet,或Visual Studio - 我试过两个)
-
dotnet restore,dotnet build(构建失败......)
Project WebApiCoreT (DNXCore,Version=v5.0) will be compiled because some of its inputs were newer than its oldest output. Compiling WebApiCoreT for DNXCore,Version=v5.0 C:\Data\Code\WebApiCore\WebApiCoreT\project.json(9,29): error NU1002: The dependency Microsoft.CodeAnalysis.Common 1.1.0-rc1-20151109-01 does not support framework DNXCore,Version=v5.0. C:\Data\Code\WebApiCore\WebApiCoreT\project.json(9,29): error NU1002: The dependency Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 does not support framework DNXCore,Version=v5.0.
编译失败 . 0警告2错误
时间过去了00:00:01.2486558
- dnu恢复,dotnet构建,dotnet运行(构建成功,在运行时失败......)
项目WebApiCoreT(DNXCore,Version = v5.0)将被编译,因为它的一些输入比其最早的输出更新 . 为DNXCore编译WebApiCoreT,版本= v5.0
编译成功 . 0警告0错误
时间过去了00:00:01.2756028
Could not resolve coreclr path
据我所知,dnu,dnx,dnvm工具链已弃用,最终会消失,但如何使用dotnet CLI创建WebAPI?
无论如何使用dotnet CLI构建任何东西,除了默认的“Hello world!”控制台应用?
1 回答
您将无法使用CLI编译由Yeoman生成的应用程序(因为它生成RC1(dnx)项目模板和引用) .
使用MusicStore sample作为模板,了解dotnet Web应用程序的外观 .