all groups > visual studio .net setup > november 2004 >
You're in the

visual studio .net setup

group:

Installing a delayed-signed assembly into the GAC


Installing a delayed-signed assembly into the GAC shippyatdrexel NO[at]SPAM yahoo.com
11/10/2004 9:04:42 AM
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?

RE: Installing a delayed-signed assembly into the GAC tderksen NO[at]SPAM online.microsoft.com
11/11/2004 7:27:10 PM
What is happening is that Visual studio detects the file has changed since
it built it (the signing of it)
What you can do to use project output is do the signing in the post build
event of the C# dll, this will cause it to build every time you build teh
setup project however it will be signed before it is included in the setup
project.

Todd Derksen
--------------------
Visual Basic Deployment Test Team
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
[quoted text, click to view]
AddThis Social Bookmark Button