Problems signing an assembly with a key stored in key container (VS2005)

by Miha Markič 11. February 2006 18:39

This is one of those problems you can't understand how could it happen.

Some background: In the past Visual Stuidio versions you were able to sign an assembly using a key stored in a file (snk) or in a safe store named key container. There were two assembly scoped attributes named AssemblyKeyFile and AssemblyKeyName respectively. I prefered the later since I didn't have to deal with file location and the data is stored in a safe place.

Now, here comes Visual Studio 2005 with a project property page for signing assemblies (Signing tab in Project Properties) which has a check box whether to sign assembly or not and a combo box that locates the file being used for signing. And if you wonder how can you sign the assembly using key container you are out of luck - no option there.
Now you say, no problem, I will sign it the old way using assembly scoped attribute. Actually you still can, but you'll get a warning (AssemblyKey* attributes are deprecated):

Warning 1 Use command line option '/keycontainer' or appropriate project settings instead of 'AssemblyKeyName' E:\Visual Studio 2005\Projects\MyProject\Properties\AssemblyInfo.cs 36 12 MyProject

Hmm. Ok, since I don't like warnings, I will go passing that /keycontainer parameter through one of Project Properties page. But you can't. Again, no option there.

Fortunately there is a simple workaround which involves modification of csproj file by hand. You should add this node right under the first <PropertyGroup>node:

<KeyContainerName>YourKeyName</KeyContainerName>

(found via this thread).

Happy signing.

Tags:

.net

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Miha Markic

About me
Righthand
 
Microsoft MVP
 
Developer Express' DXSquad
INETA Country Leader for Slovenia
INETA Country Leader for Slovenia

Slovene Developer Users Group Lead
Friends of Red-Gate
LLBLGenPro Partner

Miha currently works as a free lance consultant and software developer specialized in .net area.
He graduated in Computer and information science at the University of Ljubljana, Slovenia. He has accumulated experience in various programming languages such as Java, Visual Basic 3-6 (MCP), Visual C++, Delphi, C# and VB.Net through years.
He has experience in practically all (technical) stages of project development, including planning, framework development, user interface, business processes, as well as testing and documenting. He has worked on big and small projects in Slovenia and abroad (e.g. participated in completing level 3 IS for the Nucor steel plant, Hertford, USA).
Currently he enjoys programming in .net environment using C#. Since 2000 he has been active in Developer Express' DX Squad and has been ECDL trainer and tester. He also gives lectures on conferences and other events in Slovenia.

Month List

Tag cloud

Most comments

Paulius Paulius
1 comments
us United States
Meh Meh
1 comments
us United States
bart dm bart dm
1 comments
nl Netherlands

RecentComments

Comment RSS