Dotneteers.net
All for .net, .net for all!

Visual Studio 2010 Packages: No need for Package Load Key

With the release of Visual Studio 2010 Beta1 I started iterating through the chapters of my forthcoming book with working title “Visual Studio 2010 Extensibility”. The chapters already prepared have been written with Visual Studio 2008 features and I’m just adopting them to the Visual Studio 2010 feature set.

In Visual Studio 2008 packages have a concept called Package Load Key with the following background:

Visual Studio loads packages in the same process space as the IDE runs within. If we start more than one Visual Studio instance, each of them uses a separate process space to load the packages. If you were a process, you were careful about what kind of executable code you allow being loaded into your body to avoid accidents and malicious entities. Visual Studio also checks packages being loaded. Any VSPackage should be “sealed” with a so-called Package Load Key (PLK) and this key is verified during package load time. PLK is not a digital signature or a full hash, because it is calculated from a few information fields in the package. PLK can be requested from Microsoft through a webpage: the developer specifies a few well-defined attributes of the package and some logic calculates the PLK value. This value gets embedded as a resource into the assembly representing the package.

Every time a package is loaded, the Shell checks the PLK against the package attributes it was created from. Should this check fail, the Shell would refuse loading the package. This PLK mechanism does not mean that you should request a new PLK every time when you modify your package. You can change the code bravely. While you do not change the basic information the PLK is generated from, your package will continue to load. Should you touch any of those fields, you definitely need a new PLK.

Although this concept seemed something useful, in the real life in does not have too much advantages. To be honest, in most of the cases it is the root cause of deployment issues, in many scenarios it raises more problems than it solves.

The good news is that you do not need PLKs in Visual Studio 2010 anymore. When installing VS 2010 SDK Beta1 and you create a new package, the source code generated does not uses the ProvideLoadKey attribute to set up the PLK.

I think all VSPackage developers’ life gets easier with not using the PLK anymore. The only looser seems to be me as I have to drop about four pages from the book J


Posted Jun 28 2009, 12:04 PM by inovak
Filed under: ,

Comments

Utkarsh wrote re: Visual Studio 2010 Packages: No need for Package Load Key
on Mon, Jun 29 2009 17:47

I am a regular follower of your blog. Very informative. Awaiting release of your book.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?