user3401335 user3401335 -4 years ago 172
C# Question

adding class library to web application with net core

I'v created a web application with net core and with this project

"frameworks": {
"net461": {
"dependencies": {
"Core": {
"target": "project"
}
}
}
},


Then I've crated a class library net core with this project

"dependencies": {
"NETStandard.Library": "1.6.0"
},

"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}


but when I try to add the class project to web application, VS2015 tell me

The following project are not supported as reference.
WebApplication:
.NETFramework, Version=v4.6.1
ClassLibrary:
.NETStandard, Version=v1.6


How can I add class library to main project?

Answer Source

You have to start your project as a dotnetcore project (see image below) because it seems like you want to add a framework 4.6 file to your dotnetcore application.

dotnetcore project

for more information about dotnetcore compatibulity check this post Compatibility between dotnetcore and framework 4.5

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download