3

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!

3
  • As far as I know you can't. But you can deploy them as a separate service and use HTTP/MSMQ/whatever to communicate with them. Commented Sep 1, 2016 at 18:55
  • @LeonCullens You can't reference .Net 4.x from netcoreapp1.0 applications, but you can use .Net Core tools to create .Net 4.x applications, which is what this question is about. Commented Sep 1, 2016 at 21:06
  • @svick yea, but then you're no longer running on .NET core, so you're missing the cross-platform compat and the performance. Commented Sep 1, 2016 at 21:17

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.