Migrating a Legacy Language Service
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2019. Download it here
You can migrate a legacy language service to a later version of Visual Studio 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 editor adapts it.
Legacy language services are implemented as part of a VSPackage, but the newer way to implement language service features is to use MEF extensions. To find out more about the new way to implement a language service, see Editor and Language Service Extensions.
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 a Later Version
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.
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 a later version
Install the newer versions of Visual Studio and the Visual Studio SDK. For more information about ways to install the SDK, see Installing the Visual Studio SDK.
Edit the RegExLangServ.csproj file (without loading it in Visual Studio.
Importnode that refers to the Microsoft.VsSDK.targets file, replace the value with the following text.
Save the file, and then close it.
Open the RegExLangServ.sln solution.
The One-way upgrade window appears. Click OK.
Update the project properties. Open the Project Properties window by selecting the project node in the Solution Explorer, right-clicking, and selecting Properties.
On the Application tab, change Target framework to 4.6.1.
On the Debug tab, in the Start external program box, type <Visual Studio installation path>\Common7\IDE\devenv.exe..
In the Command line arguments box, type /rootsuffix Exp.
Update the following references:
Remove the reference to Microsoft.VisualStudio.Shell.9.0.dll, then add references to Microsoft.VisualStudio.Shell.14.0.dll and Microsoft.VisualStudio.Shell.Immutable.11.0.dll.
Remove the reference to Microsoft.VisualStudio.Package.LanguageService.9.0.dll, then add a reference to Microsoft.VisualStudio.Package.LanguageService.14.0.dll.
Add a reference to Microsoft.VisualStudio.Shell.Interop.10.0.dll.
Open the VsPkg.cs file and change the value of the
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.
In the file's Properties, set Build Action to None.
Open the file with the VSIX Manifest Editor.
Change the following fields:
Product Name: RegExLangServ
Description: A regular expression language service.
Under Assets, click New, select the Type to Microsoft.VisualStudio.VsPackage, set the Source to A project in current solution, and then set the Project to RegExLangServ.
Save and close the file.
Build the solution. The built files are deployed to %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\14.0Exp\Extensions\MSIT\ RegExLangServ\.
Start debugging. A second instance of Visual Studio opened.