I have a package that is built using .net Standard 2.0. I want to be able to utilise it in both .net Framework and .net Core applications but it has the following line of code:
using System.Runtime.Loader;
…
AssemblyLoadContext.Default.Unloading += (ctx) => ProcessStop();
…
This doesn't work for the .net Framework (seems like the System.Runtime.Loader is a core only package). I can omit it at compile time using this sort of statement:
#if NETCOREAPP2_0 || NETCOREAPP2_1
AssemblyLoadContext.Default.Unloading += (ctx) => ProcessStop();
#endif
Which doesn't help me when the package is compiled already and I want to use it in .net Framework. Anyone know how to do this sort of thing inline?
Thanks for any pointers in advance!