I have developed this batch file with which you can easily strong name a dll. This is how you do it.
Prerequisites:
1>Copy paste the bolded text below into notepad and save it with a .bat extension.
@echo off
REM DOTNETANALYSIS.BLOGSPOT.COM
SET "sourceLocation=C:\Development\Sandbox\DB2Read\thirdPartydll\"
SET "sourceDllName=EnterpriseLibraryContrib.Data.DB2.dll"
SET "destDllName=Data.DB2.dll"
REM DO NOT SET VARIABLES BELOW THIS LINE
SET "keyFileName=sgKey.snk"
SET "sourceFile=%sourceLocation%%sourceDllName%"
SET "destIL=%sourceLocation%INTERMEDIATE.IL"
SET "destFile=%sourceLocation%%destDllName%"
ECHO CREATING A KEY FILE FOR SIGNING THE DLL
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\sn" -k %keyFileName%
ECHO CREATING DE ASSEMBLED VERSION OF THE DLL
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\ildasm.exe" %sourceFile% /output:%destIL%
ECHO GENERATING THE SIGNED VERSION OF THE DLL
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm.exe" %destIL% /dll /key:%keyFileName% /output:%destFile%
ECHO -------------------------------------------------
ECHO ----VERIFYING THAT THE VERSION IS SIGNED --------
ECHO -------------------------------------------------
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\sn" -v %destFile%
pause
2>Change the values of the variables in red to reflect your source dll location, source dll name and the desired destination dll name.
3>Double click the batch file.
References:
http://msdn.microsoft.com/en-us/library/6f05ezxy.aspx
http://msdn.microsoft.com/en-us/library/496e4ekx(v=VS.90).aspx
Prerequisites:
- Windows XP
- .net framework 3.5
- Visual studio 2008
1>Copy paste the bolded text below into notepad and save it with a .bat extension.
@echo off
REM DOTNETANALYSIS.BLOGSPOT.COM
SET "sourceLocation=C:\Development\Sandbox\DB2Read\thirdPartydll\"
SET "sourceDllName=EnterpriseLibraryContrib.Data.DB2.dll"
SET "destDllName=Data.DB2.dll"
REM DO NOT SET VARIABLES BELOW THIS LINE
SET "keyFileName=sgKey.snk"
SET "sourceFile=%sourceLocation%%sourceDllName%"
SET "destIL=%sourceLocation%INTERMEDIATE.IL"
SET "destFile=%sourceLocation%%destDllName%"
ECHO CREATING A KEY FILE FOR SIGNING THE DLL
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\sn" -k %keyFileName%
ECHO CREATING DE ASSEMBLED VERSION OF THE DLL
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\ildasm.exe" %sourceFile% /output:%destIL%
ECHO GENERATING THE SIGNED VERSION OF THE DLL
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm.exe" %destIL% /dll /key:%keyFileName% /output:%destFile%
ECHO -------------------------------------------------
ECHO ----VERIFYING THAT THE VERSION IS SIGNED --------
ECHO -------------------------------------------------
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\sn" -v %destFile%
pause
2>Change the values of the variables in red to reflect your source dll location, source dll name and the desired destination dll name.
3>Double click the batch file.
References:
http://msdn.microsoft.com/en-us/library/6f05ezxy.aspx
http://msdn.microsoft.com/en-us/library/496e4ekx(v=VS.90).aspx
You saved my life! I love you!!
ReplyDeleteIm glad I could help :)
ReplyDelete