none
Unable to sign an imported msi.dll assembly using tlbimp RRS feed

  • Question

  • I have an msi.dll wrapper (named Interop.WindowsInstaller.dll) which I need to sign. The way to do it is by signing it upon import (this specific case is even documented in MSDN: http://msdn.microsoft.com/en-us/library/zec56a0w.aspx ).

    BUT - no matter how I do it (w/ or w/o a keyfile, w/ or w/o adding "/delaysign"), the generated assemly's size is always 36,864 bytes and when viewing the DLL's properties there is no "Digital Signatures" tab (needless to say - the DLL is NOT signed).

    What am I missing here?? (... HELP!...)

    Wednesday, April 21, 2010 3:43 PM

Answers

  • Thank you for the reply - it helped me regain my sanity.

    So, I used the following line to sign-upon-import the assembly:
    tlbimp C:\WINDOWS\system32\msi.dll /out:Interop.WindowsInstaller.dll /keyfile:MyKey.snk

    I then copied the file to the appropriate location and built the project, but each time the build failed on the following error: Assembly generation failed -- Referenced assembly 'Interop.WindowsInstaller' does not have a strong name

    I thought the problem was with the tlbimp line, but after reading your reply and verifying that the DLL is strong-named (using sn -vf Interop.WindowsInstaller) I found out the problem.

    Adding a reference to the "Microsoft Windows Installer Object Library" COM object actually planted a code block into the .csproj file. I didn't realize it, but this block cause the DLL file to be regenerated from scratch upon each time the project was built. The generated file, of course, was not strong-named anymore.

    The way I resolved it was to remove the reference to "Microsoft Windows Installer Object Library" from the project, and add a direct file reference to the imported (and already signed) Interop.WindowsInstaller.dll file.

    Thanks again!

    • Edited by s.k.y.d Thursday, April 22, 2010 5:10 PM cosmetics
    • Marked as answer by s.k.y.d Thursday, April 22, 2010 5:11 PM
    Thursday, April 22, 2010 5:09 PM

All replies

  • tlbimp signs the assembly only for .NET (strong name signing). The Digital Signature tab is Windows concept for Authenticode signing which is independent on strong name signing.
    For more info read this:
        http://blogs.msdn.com/pusu/archive/2008/05/06/code-signing-strong-name-and-authenticode.aspx
        http://msdn.microsoft.com/en-us/magazine/cc163583.aspx

    -Karel

    Wednesday, April 21, 2010 4:38 PM
    Moderator
  • Thank you for the reply - it helped me regain my sanity.

    So, I used the following line to sign-upon-import the assembly:
    tlbimp C:\WINDOWS\system32\msi.dll /out:Interop.WindowsInstaller.dll /keyfile:MyKey.snk

    I then copied the file to the appropriate location and built the project, but each time the build failed on the following error: Assembly generation failed -- Referenced assembly 'Interop.WindowsInstaller' does not have a strong name

    I thought the problem was with the tlbimp line, but after reading your reply and verifying that the DLL is strong-named (using sn -vf Interop.WindowsInstaller) I found out the problem.

    Adding a reference to the "Microsoft Windows Installer Object Library" COM object actually planted a code block into the .csproj file. I didn't realize it, but this block cause the DLL file to be regenerated from scratch upon each time the project was built. The generated file, of course, was not strong-named anymore.

    The way I resolved it was to remove the reference to "Microsoft Windows Installer Object Library" from the project, and add a direct file reference to the imported (and already signed) Interop.WindowsInstaller.dll file.

    Thanks again!

    • Edited by s.k.y.d Thursday, April 22, 2010 5:10 PM cosmetics
    • Marked as answer by s.k.y.d Thursday, April 22, 2010 5:11 PM
    Thursday, April 22, 2010 5:09 PM