Monday, May 30, 2011

Sign a .Net assembly without the source code

Two different versions of an old .Net assembly caused some deployment problems. We wanted to deploy the assembly to the GAC but neither of the two versions were signed. We needed to sign the assemblies but we did not have the source code.

After a small search I found a great tool named ILMerge.
Main purpose of ILMerge is to combine more than one .Net assemblies into one assembly. The side benefit is that you can also sign the resulting assembly. It works while working with only one assembly too. This way you can sign an assembly without having the source code.
Sample command line:

ilmerge /t:library /keyfile:"c:\SomeKeyFile.snk" /out:"c:\signed\assembly.dll" "c:\unsigned\assembly.dll"

Wednesday, May 4, 2011

Entity framework class generator

I wrote a sql script to generate entity framework POCO classes: https://gist.github.com/954916

Script considers primary and foreign keys including both "one to one" and "one to many" relations.

It also writes sql object descriptions saved as extended properties to the class and property comments of POCO classes.

It is working for MS SQL 2008 and 2008 R2. I did not try to run the script on other versions.