Monday, November 12, 2007

Signing the assembly in vs 2005 when assembly have to be in .NET 1.1 version

This applies to .NET 1.1 projects created using Visual Studio 2005.

In the project properties -> signing -> create a strong key with or without password. (mykeyname.pfx -with password, mykeyname.snk - w/o password). If you try to compile now, you will get the following error:

Unrecognized command-line option: '/keyfile:mykeyname.snk'

So, "Uncheck" sign the assembly there, so that .net 1.1 assembly compiles without error. In project properties, go to Application tab and click "Assembly Information". Enter Assembly Information and click OK. This will create "AssemblyInfo.cs" (In Properties folder). In "AssemblyInfo.cs" file, enter-
[assembly: AssemblyKeyFile("mykeyname.snk")]
Now compile the assembly, which will be compiled successfully.

This assembly (dll) can now be used to register in GAC using gacutil.

0 comments: