Hi firstly i know vaguely similar questions have been asked before, but they are outdated now, I am using Visual Studio 2015 rtm and ASP.NET 5 beta 6.
I'm trying to add a reference to a normal (i.e. not vnext) class library project to my vnext web application. If I follow these steps:
Create a new web app project
Remove the "dnxcore50" framework from project.json
Add a new project for a normal class library
Manually move the class library project into the /src folder (otherwise I get error "The dependency MyClassLibrary1 >= 1.0.0-* could not be resolved.")
Add a reference to this class library
Now it builds OK, but if I try and add "using MyClassLibrary1" it says MyClassLibrary1 doesn't exist in current context.
If I then change the class library to target .NET 4 Client profile (by default it was 4.6) it does work correctly, however .NET 4 full or 4.5 does not work. I need it to be 4.5 or higher as I need to reference various packages that require this. Ideally everything would just target 4.6.
This is my project.json file:
{
"webroot": "wwwroot",
"userSecretsId": "aspnet5-WebApplication2-6767111e-0eba-42a4-9d68-4b6c20767518",
"version": "1.0.0-*",
"dependencies": {
"EntityFramework.SqlServer": "7.0.0-beta6",
"EntityFramework.Commands": "7.0.0-beta6",
"Microsoft.AspNet.Mvc": "6.0.0-beta6",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta6",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta6",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta6",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta6",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta6",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta6",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta6",
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta6",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta6",
"Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta6",
"Microsoft.Framework.Logging": "1.0.0-beta6",
"Microsoft.Framework.Logging.Console": "1.0.0-beta6",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta6"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": {
"dependencies": {
"MyClassLibrary1": "1.0.0-*"
}
}
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
}
And my global.json file:
{
"projects": [
"src",
"test",
"wrap"
],
"sdk": {
"version": "1.0.0-beta6"
}
}
See Question&Answers more detail:
os