visual studio .net setup:
I want to get my development team to start strong-naming our
assemblies, and I'd like to use delay-signing to get the benefits it
brings. This process works fine. I also want to create a Setup project
to install the application. In the Setup project, I've included the
"Primary Output" for all of the projects. Some of these are shared
assemblies, so I've moved the "Primary Output" for these to the Global
Assembly Cache Folder. Here are the steps I took to build an assembly,
sign it, and include it in the Setup project:
1. Create a public/private key pair by doing the following:
sn -k pubpriv
2. Export the public key into a new file by doing the following:
sn -p pubpriv pub
3. Build and delay sign the assembly with the following code in the
AssemblyInfo.cs file:
[assembly: AssemblyDelaySign(true)]
[assembly: AssemblyKeyFile(@"..\..\pub")]
4. Sign the assembly with the private key by doing the following:
sn -R ClassLibrary1.dll "..\..\pubpriv"
5. Create and Build a Setup project and place the Primary Output of
the shared assembly project into the "Global Assembly Cache Folder".
The problem occurs when I perform the installation. It fails with the
following error:
"An error occured
during the installion of assembly component. {guid} HRESULT:
-2146234299".
And if I look for more detail in the installer log, I can see the
following error:
"MSI (s) (3C:38): Assembly Error:The check of the signature failed for
assembly '%1'."
I'm guessing the problem is that, even though I delay-sign the
assembly in step 4 above, as soon as I build the Setup project it
rebuilds the assembly, overwriting the signature. And then the
installation fails when it tries to add the assembly to the GAC
because the assembly isn't signed.
So what is the process for including a delay-signed assembly in a
Setup project? In particular, an assembly that needs to be installed
in the GAC?