7

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?

Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
  • Can you set it to copy local and then do an assembly bind to that version and see if it works? I have no idea why it's not working btw but I'd try this if I were you and see how it goes. – kha Nov 03 '17 at 15:06
  • Version 0 is not a very happy number, hard to imagine what kind of sledgehammer was involved. In general, the .NETCore runtime cannot load a .NET Framework assembly, you'd have to rebuild the assembly by targeting .NETStandard. That is not necessarily simple, they did release a core replacement for System.Configuration recently. As always, the best advice is to wait until they are done. The proverbial version 3, perhaps. – Hans Passant Nov 03 '17 at 15:40
  • What universe am I living in? Are these machines supposed to be putting everyone out of a job in the next couple of decades? – Ian Warburton Nov 03 '17 at 15:59
  • Related post - [How do I reference a .NET Framework project in a .NET Core project?](https://stackoverflow.com/q/38148128/465053) – RBT Sep 28 '21 at 09:40

2 Answers2

4

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?

Alex Sanséau
  • 8,250
  • 5
  • 20
  • 25
2

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.

Lex Li
  • 60,503
  • 9
  • 116
  • 147