简体   繁体   English

ASP.NET 5 RC Web API +框架4.6 RC库

[英]ASP.NET 5 RC Web API + Framework 4.6 RC Lib

I'm currently testing the Visual Studio 2015 RC and encounter a problem that I'm not able to solve. 我目前正在测试Visual Studio 2015 RC ,遇到无法解决的问题。

What I did is to create an ASP.NET 5 Web Api project as well as a class library project targeting .Net Framework 4.6 . 我要做的是创建一个ASP.NET 5 Web Api项目以及一个针对.Net Framework 4.6类库项目。

Then, I tried to add a reference from my Web Api project on my class library but that's not working. 然后,我尝试从我的类库中的Web Api项目中添加引用,但这种方法不起作用。 I saw that VS updated my project.json file with the following fragment 我看到VS用以下片段更新了我的project.json文件

"framework": {
  "dnx451": {
    "dependencies": {
       "Framework.Core.Launcher":"1.0.0-*"
     }
   },
   "dnxcore50": {}
}

The errors in VS are: VS中的错误是:

1) Nuget Package Restore failed for one or more packages.

2) Dependency Framework.Core.Launcher >= 1.0.0-* could not be resolved

I'm using the Release Candidate of all mentionned Tools/Frameworks 我正在使用所有提到的工具/框架的候选版本

Update 更新

It other words, is it possible to run an ASP.NET 5 Web Api project with the folling configuration (project.json): 换句话说,是否可以使用以下配置(project.json)运行ASP.NET 5 Web Api项目:

"framework": {
  "dnx451": { },
}

and not 并不是

"framework": {
  "dnx451": { },
  "dnxcore50": { }
}

because without the "dnxcore50" (1st example), I have the following error at startup: "Could not find the Microsoft.AspNet.Loader.Interop NuGet package in your users packages folder. This NuGet package is required to run ASP.NET 5 web applications". 因为没有“ dnxcore50”(第一个示例),启动时出现以下错误:“在您的用户包文件夹中找不到Microsoft.AspNet.Loader.Interop NuGet包。此NuGet包是运行ASP.NET 5所必需的网络应用程序”。

And with the second one, it does not compile because my library project does not target dnxcore50... 在第二个版本中,它无法编译,因为我的库项目未针对dnxcore50 ...

Actually, this is not possible because the .NET Framework 5 is a subset of .NET 4.6 (and not the opposite!). 实际上,这是不可能的,因为.NET Framework 5是.NET 4.6的子集(并非相反!)。

I created a new WebAPI 2 project with ASP.NET 4.5 and everything just worked fine... 我使用ASP.NET 4.5创建了一个新的WebAPI 2项目,并且一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM