Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Monday, April 09, 2007

Delay Signing an Assembly in .NET

1. Creates a key-pair using sn -K.

sn -k Testkey.snk

2. Separates the public key from the private key and stores the public key in its own file.

sn -p Testkey.snk TestPublicKey.snk

Place the details in the AssemblyInfo.cs file


Since the assembly in the example does not have a valid signature, the signature validation performed by the common language runtime will fail when you try to install the assembly into the global assembly cache or load it from an application directory. However, the Strong Name tool can be used to disable signature verification of a particular assembly by using the -Vr option:

3. Uses the Strong Name tool to request that signature verification be skipped for the assembly just generated.

sn -Vr DelaySign.dll

4. A valid signature must be generated before the assembly is shipped to customers using sn -R. This is typically done by the company signing entity. You must supply the full key pair to create a valid signature.

Post a Comment