Strong named assemblies


style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">More from inside the firewall…
/>


style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> 


style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Question: Is there a way (not
programmatically) to find out if a given assembly is strong named or not?


style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Can we assign a strong name to an
assembly that is already compiled with specifying a
PublickeyToken?


style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> 


style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Answer: To determine whether an
assembly is strong named there are several alternatives. Use ILDASM and look for
a .publickey directive in the .assembly section. Use SN -T <assembly> (the
case of the -T option is important, -t means something different) and see
whether you get back a public key token or an error informing you the assembly
is not a valid strong named assembly.


style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> 


style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">You cannot convert a weakly named
assembly to a strongly named one. Doing so involves changing the name of the
assembly (by adding a public key to it) so isn’t generally a useful operation.
On top of that there would be a lot of structural problems to resolve
(re-writing metadata and the PE format updates) so it’s a non-trivial task. It
becomes easier to totally rewrite the assembly, which you might be able to
accomplish using ILDASM then ILASM (if your assembly doesn’t contain mixed
managed and unmanaged code). Whether you can do this rather depends on the
licensing for the component involved of course.


 

Comments (1)

  1. Sendhil says:

    The VS.NET Reference properties dialog too :-)