Migrating a Legacy Language Service
You can migrate a Visual Studio 2008 language service to Visual Studio 2010 by updating the project and adding a source.extension.vsixmanifest file to the project. The language service itself will continue to function as before, because the Visual Studio 2010 editor adapts it.
Notes
We recommend that you begin to use the new editor API as soon as possible. This will improve the performance of your language service and let you take advantage of new editor features.
Migrating a Visual Studio 2008 Language Service Solution to Visual Studio 2010
The following steps show how to adapt a Visual Studio 2008 sample named RegExLanguageService. You can find this sample in a Visual Studio 2008 SDK installation, in the Visual Studio SDK installation path\VisualStudioIntegration\Samples\IDE\CSharp\Example.RegExLanguageService\ folder.
Important
If your language service does not define colors, you must explicitly set RequestStockColors to true on the VSPackage:
[Microsoft.VisualStudio.Shell.ProvideLanguageService(typeof(YourLanguageService), YourLanguageServiceName, 0, RequestStockColors = true)]
To migrate a Visual Studio 2008 language service to Visual Studio 2010
Install Visual Studio 2010 and the Visual Studio 2010 SDK.
Edit the RegExLangServ.csproj file (without loading it in Visual Studio.
In the Import node that refers to the Microsoft.VsSDK.targets file, replace the value with the following text.
$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets
Save the file, and then close it.
Open the RegExLangServ.sln solution.
The Visual Studio Conversion Wizard is displayed. Click Finish.
You will see a Project Target Framework Not Installed dialog box asking you to retarget the project. Select the Retarget the project to .NET Framework 4 option.
When the conversion is finished, click Close to load the solution.
Update the project properties:
- On the Debug tab, in the Start external program box, type <Visual Studio installation path>\Common7\IDE\devenv.exe /rootsuffix Exp.
Update the following references:
Remove the reference to Microsoft.VisualStudio.Shell.9.0.dll, then add references to Microsoft.VisualStudio.Shell.10.0.dll and Microsoft.VisualStudio.Shell.Immutable.10.0.dll.
Remove the reference to Microsoft.VisualStudio.Package.LanguageService.9.0.dll, then add a reference to Microsoft.VisualStudio.Package.LanguageService.10.0.dll.
Add a reference to Microsoft.VisualStudio.Shell.Interop.10.0.dll.
Open the VsPkg.cs file and change the value of the DefaultRegistryRoot attribute to
"Software\\Microsoft\\VisualStudio\\10.0Exp"
The original sample does not register its language service, so you must add the following attribute to VsPkg.cs.
[ProvideLanguageService(typeof(RegularExpressionLanguageService), "RegularExpressionLanguage", 0, RequestStockColors=true)]
You must add a source.extension.vsixmanifest file.
Copy this file from an existing extension to your project directory. (One way to get this file is to create a VSIX project (under File, click New, then click Project. Under Visual Basic or C# click Extensibility, then select VSIX Project.)
Add the file to your project.
Open the file with the VSIX Manifest Editor.
Change the following fields:
ID: RegExLangServ
Product Name: RegExLangServ
Description: A regular expression language service.
Under Content, click Add Content, select the VS Package content type, and then select the RegExLangServ project.
Save and close the file.
Build the solution. The built files are deployed to %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\10.0Exp\Extensions\MSIT\ RegExLangServ\.
Start debugging. A second instance of Visual Studio 2010 is opened.