Поделиться через


How to: Migrate VSPackages to Visual Studio 2010

The procedures in this topic show how to migrate VSPackages to Visual Studio 2010.

Migrating to Visual Studio 2010

This procedure shows how to migrate a basic VSPackage project to Visual Studio 2010.

To migrate a basic VSPackage solution to Visual Studio 2010

  1. Install Visual Studio 2010 and the Visual Studio 2010 SDK.

  2. Open the project file as a file in Visual Studio. (On the File menu, click Open, then Open File, then open the file).

  3. Make the following change in the .csproj file:

    • in the Import node referring to the Microsoft.VsSDK.targets file, replace the value with the following:

      $(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets

  4. Save your changes to the .csproj file, then close it.

  5. Open the solution in Visual Studio. (On the File menu, click Open, then Project\Solution, then open the solution.)

  6. You will see the Visual Studio Conversion Wizard. Click Finish. When the conversion is finished, if the .NET Framework 3.5 is not installed on the machine, you should see a dialog box asking whether to retarget the project to the .NET Framework 4. Click Yes. After that click Close. The solution should load normally.

  7. Update the following project properties. (In the Solution Explorer, under the project node, click Properties.)

    • in the Application tab, change TargetFramework to the .NET Framework 4

    • in the Debug tab, in the Start external program textbox, change the path to:

      <VSInstallDir>\Common7\IDE\devenv.exe

      where <VSInstallDir> is the location of the Visual Studio 2010 installation.

  8. Update the following references:

    • remove the reference to Microsoft.VisualStudio.Shell.9.0, then add a reference to Microsoft.VisualStudio.Shell.10.0.dll

    • if there is a reference to Microsoft.VisualStudio.Package.LanguageService.9.0, remove it, then add a reference to Microsoft.VisualStudio.Package.LanguageService.10.0.dll

    • add a reference to Microsoft.VisualStudio.Shell.Immutable.10.0.dll

    • add a reference to Microsoft.VisualStudio.Shell.Interop.10.0.dll

  9. Open the VsPkg.cs file and remove the DefaultRegistryRoot attribute.

  10. Add a text file to the project and name it source.extension.vsixmanifest.

  11. Open the file with the XML Editor, not the designer.

  12. Add the following text to the file:

    <?xml version="1.0" encoding="utf-8"?>
    <Vsix Version="1.0.0" xmlns="https://schemas.microsoft.com/developer/vsx-schema/2010">
      <Identifier Id="Project ID">
        <Name>Project Name</Name>
        <Author>Author Name</Author>
        <Version>1.0</Version>
        <Description xml:space="preserve">Information about my package</Description>
        <Locale>1033</Locale>
        <InstalledByMsi>false</InstalledByMsi>
        <SupportedProducts>
          <VisualStudio Version="10.0">
            <Edition>Pro</Edition>
          </VisualStudio>
        </SupportedProducts>
        <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />
      </Identifier>
      <References>
        <Reference Id="Microsoft.VisualStudio.MPF" MinVersion="10.0">
          <Name>Visual Studio MPF</Name>
        </Reference>
      </References>
      <Content>
        <VsPackage>|%CurrentProject%;PkgdefProjectOutputGroup|</VsPackage>
      </Content>
    </Vsix>
    

    where <Project Name> is the name of the project, <Project ID> can be any unique string that identifies the project (like the GUID), and <Author Name> is the name of the publisher of the project.

  13. Save the file.

  14. In the Properties of the source.extension.vsixmanifest file, set Build Action to None.

  15. Build the solution. The built files will be deployed to the following directory:

    %LOCALAPPDATA% \Microsoft\VisualStudio.10.0Exp\Extensions\<Author Name>\<Project Name>\1.0

    where %LOCALAPPDATA% is the value of that environment variable, <Author Name> is the name of the publisher of the project, and <Project Name> is the name of the project.

  16. Start debugging. A second instance of Visual Studio 2010 will appear.

    For more information about running VSPackages in the experimental instance, see Experimental Instance of Visual Studio.