Search code examples
c#dllcompiler-errors

How to sign compiled dll with other pfx file


I have a compiled dll that was signed with Certificate A, which is not available any more. The source code for the dll is also lost, but it is needed in a legacy project (.Net 4.6).

I have changed the certificate in the legacy project, however when i compile:

Could not load file or assembly 'the dll,Version:0.0.2.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x90131044)

I found several posts on how to decompile, change the signing and then recompile, however all of them are using .snk and not .pfx

How would I do this?


Solution

  • The solution was to decompile the original DLL using dotPeek and to add the decompiled dll as project to the visual studio solution. After some cleanup it compiled and i could change the certificate.