Tuesday, March 23, 2010

Strong Name an existing assembly (dll)

Today I needed to strong name an existing third party assembly in order to use it for SharePoint (GAC). I found a great solution from "DoubleJ" at http://sadeveloper.net/forums/p/1195/5115.aspx

I copied it here in order to make sure I does not get lost:

"From a VS.NET command prompt, enter the following:

1. Generate a KeyFile
sn -k keyPair.snk

2. Obtain the MSIL for the provided assembly
ildasm providedAssembly.dll /out:providedAssembly.il

3. Rename/move the original assembly
ren providedAssembly.dll providedAssembly.dll.orig

4. Create a new assembly from the MSIL output and your assembly KeyFile
ilasm providedAssembly.il /dll /key= keyPair.snk

Viola! You now have a strong named assembly."

Sunday, March 7, 2010

WebPart button event fires only once

In order to make sure a button in a WebPart (for example to export data to excel) can be clicked more than once add the following to the OnClientClick event:

buttonExportToExcel.OnClientClick = "_spFormOnSubmitCalled = false;_spSuppressFormOnSubmitWrapper=true;";