Skip to content

Instantly share code, notes, and snippets.

@jcansdale
Created January 17, 2019 20:20
Show Gist options
  • Save jcansdale/5fcf9a9f5c9fb6487b4c46fe6b0b339d to your computer and use it in GitHub Desktop.
Save jcansdale/5fcf9a9f5c9fb6487b4c46fe6b0b339d to your computer and use it in GitHub Desktop.
public string FindOutputFilePath(IVsTextManager2 textManager, IVsEditorAdaptersFactoryService adapters)
{
if(textManager.GetActiveView2(1, null, (uint)_VIEWFRAMETYPE.vftCodeWindow, out IVsTextView activeView) == VSConstants.S_OK)
{
var textView = adapters.GetWpfTextView(activeView);
var doc = textView.TextBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
return doc.Project.OutputFilePath;
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment