Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use .net framework from .net core?

I have a .net core xUnit project that references a .net framework project that references Microsoft's Azure Notification Hub API.

It builds, but when try and create a hub, I get the error...

Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

Which seems like an odd error to get given that System.Configuration is referenced.

How do I make the Azure referencing project act like a framework 4.7 project?

like image 990
Ian Warburton Avatar asked Nov 03 '17 14:11

Ian Warburton


People also ask

Can you use .NET framework from .NET Core?

You can use the Full . NET Framework (TFM) with . NetCore 2.0, but how?

Can .NET Core and .NET framework coexist?

https://learn.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server According to this document, the answer is no.

Can I install .NET Framework and .NET Core on the same machine?

NET Core installations are completely independent from the version of . NET Framework. In fact, you can actually install multiple version of . NET Core side-by-side on the same machine (unlike .


2 Answers

If you are targeting .NET Core, make sure you've referenced NuGet package System.Configuration.ConfigurationManager.

See related question: Is ConfigurationManager.AppSettings available in .NET Core 2.0?

like image 182
Alex Sanséau Avatar answered Oct 25 '22 01:10

Alex Sanséau


Microsoft just shipped a new version that's compatible to .NET Standard 2.0,

https://azure.microsoft.com/en-us/updates/azure-notifications-hubs-net-sdk-now-compatible-with-net-standard-2-0/

Please upgrade your SDK to use that. Of course, you need to make other changes according to their documentation.

like image 38
Lex Li Avatar answered Oct 25 '22 03:10

Lex Li