简体   繁体   中英

.Net DLL reference error (after strong name sign)

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?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM