.Net DLL reference error (after strong name sign)

205 views Asked by At

Here is my scenario. I have Few applications using ABCD.dll (written in C# .net), this old DLL was NOT strong name signed.

I modified this dll basically kept the same name ABCD.dll and signed it with the key. Please note there is no code change

I thought I should be able to just place this newly updated DLL into different applications folders and it should work. Am I wrong?

I am getting following error

BadImageFormatException: Could not load file or assembly 'ABCD, Version=7.2.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

How do I use this new dll without compiling all the old applications?

2

There are 2 answers

0
Jon Skeet On

Am I wrong?

Yes, basically. Changing the signature on a DLL, including from "not having one" to "having one" is a breaking change - it changes the identity of the DLL as far as the CLR is concerned.

How do I use this new dll without compiling all the old applications?

You don't, as far as I'm aware. I don't know of any way of getting that to work. I suggest you take the hit and rebuild everything.

0
Jonas Smith Muller On

You can, if you're lucky 'just' change the reference to the new .DLL. There are tools for this.

You can try this one: https://marketplace.visualstudio.com/items?itemName=markkemper1.ReferenceSwitcher