I am using VS2015 CTP5 and I am referencing a legacy class library compiled with 4.5.1. During compile, I get this warning:
The primary reference "D:\components.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.5.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".
Here is my project.json after adding the reference
"frameworks": {
"aspnet50": {
"dependencies": {
"components": "1.0.0-*"
}
}
},
Since the "component" library is build for .net 45 and assuming that you build that library in an older version of visual studio, it will not work in aspnetcore5 but will work on aspnet5 (these are the new version for .net). if you want to get rid of the error and still use your component library, you will need remove the aspnetcore5 json node from the project.json file but the project that you building will not be compatible with aspnetcore5. So your project.json file for the frameworks section should look like this.
"frameworks": {
"aspnet50": {
"frameworkAssemblies": {
"System": "4.0.0.0"
},
"dependencies": {
}
},
"net45": {
"dependencies": { "components": "1.0.0"},
"frameworkAssemblies": { }
}
}
And your reference should look like, I have warning sing next to the component library because I don't have that in my code.
You can look at this question to get more information.
Question 1, Question 2
Add the library to frameworkDependencies
not dependencies
"net45": {
"frameworkAssemblies": {
"components": "1.0.0"
},
"dependencies": {
// NuGet packages go here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With