Attach VsPackage to Roslyn Instance

两盒软妹~` 提交于 2019-12-10 18:09:30

问题


I'm trying to create a VsPackage that makes use of the Roslyn Language Services. Under the properties of my VsPackage, I've changed the command line arguments to:

/rootsuffix Roslyn

When running the project, the instance of Visual Studio that starts up is correctly using Roslyn. (I see [Roslyn] next to the names of .cs files I have open). However, my VsPackage is not deployed to this instance of Visual Studio.

I have opened up the SyntaxVisualizerExtension VsPackage that ships with Roslyn and compiled/run that. It correctly deploys to Visual Studio using Roslyn. I've looked through the project properties and references and nothing has stood out to me as missing.

The steps I'm taking are :

  1. File > New Project > Visual Studio Package
  2. Create with Tool Window
  3. Open Project properties, change /rootsuffix Exp to /rootsuffix Roslyn
  4. Add references to Roslyn .dlls
  5. Run project.

In theory, I could probably strip down the SyntaxVisualizerExtension Package, but I'd like to know the proper way to create a VsPackage for the Roslyn instance.


回答1:


There's no UI setting to control what the property is. Edit your project file in Notepad (or unload the project in VS and then right click and choose "edit"), and add this line:

<VSSDKTargetPlatformRegRootSuffix>Roslyn</VSSDKTargetPlatformRegRootSuffix>

into the appropriate PropertyGroup. Look in the projects created via any of the Roslyn templates for an example.



来源:https://stackoverflow.com/questions/20604562/attach-vspackage-to-roslyn-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!