Created
September 12, 2014 17:42
-
-
Save JoshVarty/c4ddcfefd2d39d5150fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void Initialize() | |
{ | |
//Other stuff... | |
... | |
var componentModel = (IComponentModel)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SComponentModel)); | |
var workspace = componentModel.GetService<Microsoft.VisualStudio.LanguageServices.VisualStudioWorkspace>(); | |
} | |
//Alternatively you can MEF import the workspace. This has given me a lot of problems, | |
//so I prefer not to use MEF here, but here's how you'd import it as a property. | |
[Import(typeof(Microsoft.VisualStudio.LanguageServices.VisualStudioWorkspace))] | |
public VisualStudioWorkspace myWorkspace { get; set; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment