Targeting VS 2008 with the Visual Studio 2010 SDK

Recently, a customer asked us if it was possible to develop and debug a VB/C# extension with Visual Studio 2010 (and the 2010 SDK), but still have a binary that also works with VS 2008. This is indeed possible, but it requires some hacking of your project file to get it set up.

One nice thing about this solution is that you can easily switch between targeting 2008 and 2010 by simply changing the startup project between the package project and the VSIX project.

Setup machine with VS 2008 SP1 + VS2008 SDK 1.1 + VS2010 Beta 2 + VS2010 Beta 2 SDK

  1. In VS 2008 : create a VB or C# VSPackage
    • (optionally) Build/F5 to verify that it builds/loads as expected in 2008 Experimental Hive
    • Close VS 2008 Instances
  2. Launch VS 2010, open the solution, and proceed with project upgrade wizard
  3. Unload the VSPackage project, edit the project file, and add the following target after the Imports statements at the bottom:

    <Target Name="PkgdefProjectOutputGroup" Outputs="@(PkgdefOutputGroupOutput)">  
      <RegPkg ItemToRegister="$(TargetPath)"  
        UseVS2005MPF="$(__InternalUseMPF80)" />     
        <_PkgdefOutputGroupOutput Include="$(IntermediateOutputPath)$(TargetName)_.pkgdef" /> 
        <PkgdefOutputGroupOutput Include="@(_PkgdefOutputGroupOutput->'%(FullPath)')" /> 

  4. Reload the VSPackage project
  5. Add a VSIX Project to the solution (From Visual C#\Extensibility or Visual Basic\Extensibility in the New Project Dialog)
    • Note: You do not have to distribute your package in a VSIX container. This is simply a requirement for registering and debugging in the VS 2010 Experimental Instance.
  6. Add a Project Reference from the VSIX Project to the VSPackage project
  7. Unload the VSIX project, edit the project file, and add the following inside the <ProjectReference> node:


  8. Reload the VSIX Project
  9. Right-click the VSIX Project node and “Set as Startup Project” (if you wish to run/debug the package under VS2010)
  10. F5 to debug the package running in the VS2010 Experimental Instance with VS2010

Comments (1)
  1. rajivverma_it says:

    Thanks for your blog. I was looking for exactly this and so far its only your blog what I have found.

    I followed your steps but when I tried to build my solution after these changes, I got this error on "VSIX Project"…

    Error 8 The "RegPkg" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:WINDOWSMicrosoft.NETFrameworkv4.0.21006" directory. Z:My ProjectPackageProjectPackageProject.csproj 422 5 VSIXProject

    Just to confirm your step 6…

    I added my package project as reference into VSIX Project.

    And while doing step 7, the project file editor highlighted <IncludeOutputGroupsInVSIX> as error and tooptip said this…

    "The element ‘ProjectReference’ in namespace ‘‘ has invalid element ‘IncludeOutputGroupsInVSIX’ in namespace ‘‘. List of possible elements exptected: ‘Name, Project, ReferenceOutputAssemply, SpecificVersion, Targets, OutputItemType, Package, EmbedInteropTypes’ in namespace ‘‘."

    Please let me know where am I going wrong.

Comments are closed.

Skip to main content