 |
 |
|
SharePoint Quick Links
|
Article Categories
|
Archives
August, 2008 (10)
July, 2008 (14)
June, 2008 (12)
May, 2008 (23)
April, 2008 (12)
March, 2008 (15)
February, 2008 (13)
January, 2008 (12)
December, 2007 (10)
November, 2007 (8)
October, 2007 (15)
September, 2007 (20)
August, 2007 (21)
July, 2007 (16)
June, 2007 (8)
May, 2007 (25)
April, 2007 (16)
March, 2007 (18)
February, 2007 (18)
January, 2007 (12)
December, 2006 (16)
November, 2006 (13)
October, 2006 (18)
September, 2006 (22)
August, 2006 (27)
July, 2006 (23)
June, 2006 (23)
May, 2006 (23)
April, 2006 (9)
March, 2006 (17)
February, 2006 (15)
January, 2006 (23)
December, 2005 (31)
November, 2005 (32)
October, 2005 (38)
September, 2005 (53)
August, 2005 (30)
July, 2005 (63)
June, 2005 (30)
May, 2005 (59)
April, 2005 (29)
March, 2005 (74)
February, 2005 (27)
January, 2005 (22)
December, 2004 (32)
November, 2004 (42)
October, 2004 (39)
September, 2004 (20)
August, 2004 (14)
July, 2004 (27)
June, 2004 (40)
May, 2004 (5)
April, 2004 (6)
March, 2004 (16)
February, 2004 (26)
January, 2004 (23)
December, 2003 (7)
November, 2003 (14)
October, 2003 (20)
September, 2003 (4)
|
Post Categories
|




|
 |
|
All paths in the command line instructions below assume all files are in the c:\ root. Enter full paths where necessary. The commands themselves (sn, ildasm, ilasm) can be run from anywhere if you're in a VS.NET command prompt which is different from a regular command prompt. To launch a VS.NET command prompt, you'll find a shortcut in the tools subgroup in the VS.NET installation program group in your start menu.
When you're building assemblies, it's not hard to apply a strong name to them.
- Create a strong name assembly key file
From a VS.NET command prompt, use the SN.EXE utility to create a file containing the public key/private key pair: c:\>sn -k c:\keypair001.snk
- Add reference to the assembly key file to your assembly project
Open the AssemblyInfo.cs file in your project and add the following attribute: [assembly: AssemblyKeyFile(@"c:\keypair001.snk")]
- Compile your assembly
Same way you would any other day of the week.
- Obtain the public key to your key file
You may need this in the future. After you build your assembly, from a VS.NET command prompt, use the SN.EXE utility again to get the public key of your key pair: c:\>sn -T yourAssembly.dll
- (Added 12/16) Obtain the public key blob to your key file
You'll need this in CAS policy files... it's the hex public key blob... use the SECUTIL.EXE utility: c:\>secutil -hex -s yourAssembly.dll
However, what if you need to apply a strong name to an assembly that was provided, already compiled, to you and you don't have the source? You first will need to produce the Microsoft intermediate language (MSIL) for the assembly using the ILDASM.EXE utility, then use an assembly key file to sign that MSIL into a new DLL using the ILASM.EXE utility.
- Obtain the MSIL for the provided assembly
From a VS.NET command prompt, enter the following: c:\>ildasm providedAssembly.dll /out:providedAssembly.il
- Rename/move the original assembly
I just tack on ".orig" to the filename.
- Create a new assembly from the MSIL output and your assembly keyfile
Assuming you already have an assembly key pair file (if not, see #1 in previous steps), do the following from a VS.NET command prompt: c:\>ilasm providedAssembly.il /dll /key=keypair001.snk
You run into a problem when you get a failure when generating the DLL from the MSIL and. For example, I keep having a problem when using this method to make the Microsoft Data Application Block have a strong name for use in a SharePoint web part. I ~really~ don't want to build it with a strong name myself, I want to rebuild the one that's included from the downloadable MSI. Ideas anyone?
Update 12/16: Added links to the four .NET utilities (sn, secutil, ildasm, ilasm) referenced in this article.
posted on Wednesday, December 15, 2004 4:22 PM
|
|
MOSS WCM Training
|
|
JAX Office Geeks
Jacksonville Office Geeks (JOG)
JOG is a special interest group in Jacksonville, FL dedicated to bringing the local SharePoint commnity together to share tips, tricks, ideas and best practices for developing solutions on the SharePoint platform.
Next meeting details...
When:
Thur. Sept 18th, 2008 6-8p EDT
Topic:
Enterprise Content Management - Document Retention
Speaker:
John Holliday, MVP MOSS
RSVP Today!
» Subscribe to the JOG newsletter
|
|
|
|