Second Life of a Hungarian SharePoint Geek

September 21, 2011

Strong name verification issues when creating a customized build of the CKS.Dev solution

Filed under: CKS.Dev, SP 2010, Visual Studio — Tags: , , — Peter Holpar @ 22:44

Recently I made a minor modification to my local CKS.Dev version to enable accessing the Quick Deploy menu functionality through the keyboard shortcuts even when working on a code file. The standard behavior of version 2.1 is that you should select a SharePoint project in the Solution Explorer prior to using any of the key combination, otherwise you receive a message like this one:

The key combination (Alt + C, G) is bound to command (Copy to GAC/BIN) which is not currently available.

I found it to be a bit uncomfortable, so I loaded the solution into Visual Studio and made the required changes in the code. It turned out that altering the code was the easier part of the task.

When I tried to build the project, the following build errors were generated for the file CreatePkgDef:

Error    211    Could not load file or assembly ‘CKS.Dev, Version=2.1.0.0, Culture=neutral, PublicKeyToken=487fd6341a5c701f’ or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
Error    212    Strong name validation failed. (Exception from HRESULT: 0x8013141A)

Fortunately, I found a good description of the problem and the solution in a blog post from Charlie Holland.

Based on the post (and the Readme.txt in the CKS Developer Edition\Signing folder) I’ve started an instance of Visual Studio Command Prompt (2010) and run the DisableStrongNameVerification.bat command. It runs the sn command that adds a verification entry for assembly ‘*,487fd6341a5c701f’ to disable strong name verification for the CKS.Dev assemblies.

I’ve uninstalled the original version of CKS.Dev and started debugging the modified one using the experimental instance of VS 2010.

I pressed Alt + C, G, the command was fired through the shortcut as expected, deployed my assembly to the GAC, but finally generated the following alert:

Command ID ‘Deployment.GetApplicationPoolName’ is invalid.

And the following trace message was displayed in the Output window:

Could not load file or assembly ‘CKS.Dev.Commands.Implementation.v4, Version=2.1.0.0, Culture=neutral, PublicKeyToken=487fd6341a5c701f’ or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)

So we have turned verification off, or might be not? What is the reason for that?

As you may know (if you don’t, you should read this post first), to bridge the gap between Visual Studio 2010 (x86 process) and SharePoint 2010 (x64 process), VS runs SharePoint commands through the x64 VSSPHOST4 process.

In the former steps we disabled strong name verification only for the x86 process (Visual Studio), but to disable it for x64 (VSSPHOST4) as well, we should start Visual Studio x64 Win64 Command Prompt (2010) and run the DisableStrongNameVerification.bat command again.

Note: You can check the independency of the different versions by starting a command prompt for both x86 and x64, and adding / removing / listing entries using the sn command and the –Vr / -Vx / -Vl switches.

Then kill the VSSPHOST4 process, or simply restart VS, and things work as we planned.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: