How do I get a Roslyn workspace from a VS package?

怎甘沉沦 提交于 2019-12-06 07:27:44

I don't see any definition of VisualStudioWorkspace (or the Microsoft.VisualStudio.LanguageServices assembly)

It's there, double check you're looking in the right place.

[Import]s only work if the class you're working in itself is MEF exported. If it's not (like a Package in your case), just write:

var componentModel = (IComponentModel)GetService(typeof(SComponentModel));
var workspace = componentModel.GetService<VisualStudioWorkspace>();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!