1
votes

I may be missing something obvious. I thought the proper way to add a reference to the class library was to add "Microsoft.AspNet.Mvc" to the project.json file, which added it to the list of DNX 5 references. But in my class library (Package) project, I can't refer to it at all. What's the proper way to import the MVC library in this type of class library project?

1
The proper way is as you described by adding a reference in the project.json. Ensure you are saving project.json (dependency resolution only occurs on file save). Are you getting an errors when restoring packages (resolving dependencies)? - Gerald Davis

1 Answers

1
votes

Adding that line should get you intellisense for version if you are referencing a nuget source correctly. My packages.json dependencies look like this:

{
  "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"
},

ALso check "correct nuget reference" under Tools->Options enter image description here