Reputation: 5141
We have some .NET 4.x code we need to reference from our .NET Core website. I'm able to run .NET Core on Traditional .NET as described here by Cesar de la Torre.
PROBLEM: In order to compile, it appears I need configure all project.json files in a way that all assemblies have access to the Traditional .NET framework.
QUESTION: How can I ensure that only certain .NET Core assemblies have access to .NET 4.x?
I would like my solution to look like this:
\WebProject <-- Requires .NET 4.x because of reference to ClassLibrary1Project
\ClassLibrary1Project <-- Requires .NET 4.x
\ClassLibrary2Project <-- Prevent .NET 4.x access
\ClassLibrary3Project <-- Prevent .NET 4.x access
All the projects are .NET Core, but only WebProject
& ClassLibrary1Project
require access to the traditional .NET Framework. The only references are between WebProject
and the class library projects.
Thank you!
Upvotes: 3
Views: 669
Reputation: 244757
You should be able to do this by using netstandard1.x
in the frameworks
section in project.json for libraries that shouldn't have access to .Net 4.x and using net4xx
for libraries that should.
Make sure to use high enough version of net
, so that you can reference the netstandard
you used.
Upvotes: 2