When we create a strong named assembly and want this assembly to be used by someone else, we partially build this assembly by provide a Public Key. We write this Public Key in the AssemblyInfo.vb OR .cs file using the attribute
<assembly:assemblykeyfileattribute("somekey.snk")>
</assembly:assemblykeyfileattribute>
Note here that somekey.snk is a key that you create using sn.exe tool.
We create it like this in the command line compiler
sn.exe -k "c:\somekey.snk"
Note that we also turn off the verification of the assembly (the DLL) using the sn tool like this...
sn -Vr assemblyName.dll where -Vr is an option.
Once created, we add it to the assemblyinfo file.
We also add an attribute by the named
<assembly:assemblydelaysignattribute(true)>
to the assembly info file. This makes it sure that when we build the assembly, It would be containing the information only about the public key before we deliver it to our client or whosoever needs it.
Remember that this is a partial strong named assembly that we have created, and hence we say that it is a Delayed Assembly.
In this process, the public key is inserted into the assembly manisfest, which ultimately reserves some space for the Full Strong Named Assembly in the Portable Executable (PE) file.
In t
sn -R assemblyname.dll strongKey.snk where strongKey.snk is a strongly named key.
more info
This post is updated on 16-Nov-2007
Useful Post Thank you Dutt
Post a Comment