我可能会遗漏一些明显的东西。我认为添加对类库的引用的正确方法是添加" Microsoft.AspNet.Mvc"到project.json文件,它将其添加到DNX 5引用列表中。但是在我的类库(Package)项目中,我根本无法引用它。在这种类库项目中导入MVC库的正确方法是什么?
答案 0 :(得分:1)
如果正确引用nuget源,添加该行应该可以获得版本的智能感知。我的packages.json依赖项看起来像这样:
{
"webroot": "wwwroot",
"userSecretsId": "aspnet5-WebApplication1-f05e552f-7865-4083-bf3d-66fe6a185a3a",
"version": "1.0.0-*",
"dependencies": {
"EntityFramework.SqlServer": "7.0.0-beta4",
"EntityFramework.Commands": "7.0.0-beta4",
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta4",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta4",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta4",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta4",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.UserSecrets": "1.0.0-beta4",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta4",
"Microsoft.Framework.Logging": "1.0.0-beta4",
"Microsoft.Framework.Logging.Console": "1.0.0-beta4",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta4",
"Microsoft.Net.Http": "2.2.22"
},
另外检查"正确的nuget参考"在工具 - >选项下