How to register existing packages to run under VS 2010 Experimental Instance

Aaron Marten’s blog “Pkgdef and the Experimental Instance in VS 2010” points out that when devenv.exe is invoked with the ‘/rootsuffix Exp’ switch, the VS Shell no longer uses the experimental registry hive. Instead, the shell merges the HKLM\Software\Microsoft\VisualStudio\10.0 registry settings and the .pkgdef files in the user’s …AppData\Local\Microsoft\VisualStudio\10.0Exp\Extensions folder.

If you have an existing package binary that’s built with an earlier version of VS, and want to have it load into the VS 2010 Experimental instance, you can create a VSIX Project in VS 2010, to ensure the components are properly registered to load in the Experimental instance.

Alternatively, you can copy these files manually. But using a VSIX Project makes this a relatively quick and easy process. Just follow the steps outlined below and you should have your existing package(s), up and running in VS 2010 in no time.

Step #1: Create a new VSIX Project from the “File.New Project” dialog. Note, the VSIX Project template is included under the Visual C#\Extensibility and Visual Basic\Extensibility trees.

clip_image002

Step #2: Right click on the project node in Solution Explorer, select ‘Add->Add Existing…’ and add your package assembly, and pkgdef files to the project. If you currently do not have a pkgdef file for your package, check out “How to create a pkgdef file for your Visual Studio Package”. If your package happens to be a native C++ package with a satellite resource DLL, you’ll want to add a codepage folder to the project add your satellite resource DLL as well. For example:

clip_image004

Step #3: Set the ‘Build Action’ property to “Content”, the ‘Copy to Output Directory’ property to “Copy Always”, and the ‘Include in VSIX’ property to “True”, on each of these files. For Example:

clip_image006

Step #4: Open the .vsixmanifest in the VSIX designer (if it isn’t open already), and fill in the some of the details. For example:

clip_image008

Note, use the “Add Content” button, and add the .pkgdef as a “VS Package, as illustrated below.

clip_image010

Step #5: Right click the project node in Solution Explorer, and select the “Properties…” command to display the project designer. Then select the “VSIX” tab and ensure the “Deploy VSIX content to experimental instance” is selected. For example:

clip_image012

Step #6: Build the project to register the package for execution in the experimental instance of VS 2010.

Finally, note that the Debug settings are already configured to launch DevEnv.exe with the /RootSuffix Exp switch. So you can readily launch and debug your package running in the experimental instance. If your package happens to be native C++ like mine, you’ll want to also set the “Enable unmanaged code debugging” checkbox on the Debug Tab.