Skip to content

Instantly share code, notes, and snippets.

@PProvost
Created June 4, 2009 16:14
Show Gist options
  • Save PProvost/123691 to your computer and use it in GitHub Desktop.
Save PProvost/123691 to your computer and use it in GitHub Desktop.
A little hack to acces DTE without having an IServiceProvider
global::EnvDTE.DTE dte = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(global::EnvDTE.DTE)) as global::EnvDTE.DTE;
global::EnvDTE.ProjectItem item = dte.Solution.FindProjectItem(relativeToPathName);
global::EnvDTE.Project project = item.ContainingProject;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment