0

I'm developing a VS extension for analyzing build artifacts of the active (project user is editing) project, I need to capture the project name so that I can build the project and proceed to next step. It seems this can be achieved from DTE.ActiveSolutionProjects() object or Roslyn Workspace, What are the possible approaches for this?

Bandara
  • 780
  • 8
  • 29
  • what is active project, do you mean the active document of the project? – Zhanglong Wu - MSFT Feb 16 '17 at 05:30
  • Roslyn Workspace overview doc has following "when the user types in a text editor corresponding to one of the source documents, the workspace uses an event to signal that the overall model of the solution has changed and which document was modified" I'm also looking for similar thing, following id my use case: User open the VS IDE -> Open a .cs file -> he select "Analyze" option which will be added from my extension -> then the extension should compile the project which contains user opened .cs file. – Bandara Feb 17 '17 at 02:51
  • is it a visx project, if so, you can capture the active project via ActiveDocument var dte = (DTE2)Package.GetGlobalService(typeof(DTE)); var doc = dte.ActiveDocument; EnvDTE.Project ppp = doc.ProjectItem.ContainingProject; – Zhanglong Wu - MSFT Feb 17 '17 at 09:16
  • Thanks @Cole Wu-MSFT. – Bandara Feb 17 '17 at 10:54
  • Do you resolve the issue with the code, if so, I will post an answer, please mark it as answer, it will be beneficial to other communities who have the similar issue, if not, please feel free let me know. – Zhanglong Wu - MSFT Feb 20 '17 at 06:07

0 Answers0