I've implemented a .net DLL (in c#) which gets loaded by the OS (basically it is a ADFS MFA Adapter). This DLL references the assembly 'Microsoft.IdentityServer.Web' which is present in the OS. This works fine on Windows Server 2012 (ADFS 3.0).
This Fails on Windows Server 2016 (ADFS 4.0) as it has a newer version of the assembly 'Microsoft.IdentityServer.Web' (same public key though). How do I handle this scenario ?
- The first thing comes to my mind is build platform specific version of my DLL (one for each OS Win2012 & Win2016) referencing the appropriate assembly version. Install the DLL based on which OS it is being installed. This will have some build and install overhead.
Is there a simpler way to do this ?
- Some way for me to reference both the version of the Assemblies in my DLL's config file. When my DLL is loaded it looks for which version of assembly is present in GAC and loads the right version. (Fortunately there is only version of the dependent assembly 'Microsoft.IdentityServer.Web' in the GAC).
- I noticed some approach to add some hooking code in my DLL which gets called before Assemblies Load. Then Load the right assembly present in GAC. (AppDomain…AssemblyResolve approach). I tried this but did not have much luck to hook into the code when my DLL loads.