Reputation: 2390
I created two projects in VS 2015. Both of which were created as Class Library (Package), which generates .Net Core assemblies. In one of these projects, I removed the reference to .Net 4.5.1, so it would be strictly Core. From the other one, I added a reference to the Core only project, only to be given this compile time error.
The dependency TestCoreProject 1.0.0 in project TestWindowsProject does not support framework .NETFramework,Version=v4.5.1.
Why would this be an issue? If I had tried to reference the .Net project from the Core one, that should not work, but the .Net one should not balk at referencing the Core project.
Upvotes: 1
Views: 107
Reputation: 2390
I think I figured it out, but VS was not helpful. When VS adds a project reference, it gets added to the main dependencies in project.json. What I really want is to only reference the Core library when compiling against Core. I can do that by manually moving the referene up into the dotnet5.4 section.
"frameworks": {
"net451": { },
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516",
"TestCoreProject": "1.0.0-*"
}
}
},
"dependencies": {
}
From here I can use preprocessor directives in my code. Ultimately, after learning about all of this through trial and error, I think what I really want is to reference both frameworks in all of my libraries, though.
Upvotes: 1