Background:

The PcwTESample project, is a sample which illustrates how to extend the Team Explorer tool window, and upload customized Team Projects to TFS. It is installed with the Visual Studio 2008 SDK under the ...\ VisualStudioTeamSystemIntegration\Team Explorer and Project Creation subdirectory.

The PcwTESample that currently ships with the Visual Studio SDK for VS 2008 has a few problems.

  • The sample doesn't build properly if you don't have VS 2005 and the Visual Studio 4.0 SDK installed, in addition to your Visual Studio 2008 installation.
  • The sample has dependencies on the older Microsoft.VisualStudio.Shell.dll assembly, which requires you to register the package with the VS 2005 version of RegPkg.exe
  • The sample uses the 'old school' C++ resource dll for localization.
  • The sample doesn't have a .CTC or .VSCT resource to allow for providing custom commands or context menus.

Solution:

To address these problems, I rewrote the sample to remove the dependency on Microsoft.VisualStudio.Shell.dll, added a VSCT resource to illustrate adding a context menu to the TEPlugin node in Team Explorer, and removed the C++ satellite DLL. The sample can be downloaded from the MSDN Code Gallery at: http://code.msdn.microsoft.com/PcwTESample.

Modifications:

The original sample derived from the PluginHostPackage, and used a PluginRegistrationAttribute which both have dependencies on the older Microsoft.VisualStudio.Shell.dll. To address this, the package class now implements the IHostPlugin interface instead of inheriting it from the PluginHostPackage class. And the PluginRegistrationAttribute is rewritten in the PluginRegistration.cs file. Additionally, the updated sample builds and runs in the experimental RANU hive.

BUG ALERT: There is a known bug in the winform designer that can cause the IDE to hang, when opening the PluginSampleWizardPage.cs in the winform designer. To work around this, open the PluginSampleWizardPage.cs in the code editor, change the PluginSampleWizardPage class to derive from WizardPage instead of TeamProjectWizardPage, then reopen the PluginSampleWizardPage.cs with the winform designer. Just don't forget to change it back if you rebuild the sample :-)