Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to get Visual Studio to save the file before running an external tool?

I've have a couple of external tools set up to run Doxygen for me, either on the currently displayed file, or the currently active project.

What's annoying is, there doesn't seem to be an option anywhere to save the file before running the tool.

So I'll hammer in some Doxygen blocks, hit the hotkey to run Doxygen, flip over to Firefox to check the output, and, of course..... it's the previous version.

Sigh.

Any clues on how to get this to work in a nice way?

like image 481
Eric H. Avatar asked Oct 15 '09 15:10

Eric H.


People also ask

How do I run external tools in Visual Studio?

Open the External Tools dialog box by choosing Tools > External Tools. Click Add, and then fill in the information. For example, the following entry causes Windows Explorer to open at the directory of the file you currently have open in Visual Studio: Title: Open File Location.

How do I save my work in Visual Studio?

From the File menu, choose Save File As, and then click the drop-down button next to the Save button. The Advanced Save Options dialog box is displayed. Under Encoding, select the encoding to use for the file. Optionally, under Line endings, select the format for end-of-line characters.

How do I save a design in Visual Studio?

To save changes you have made in the Table Designer, press either Save or Save All on the Visual Studio main toolbar, or press Control + S.


2 Answers

You could create a VS macro that would save all files first and then your external tools.

like image 110
djcouchycouch Avatar answered Sep 27 '22 22:09

djcouchycouch


I have found a solution to this in VS2013 by using Visual Commander. This gives you back the ability to run macros. You can now create a macro which saves all files and then runs your external tool, eg.

Imports EnvDTE
Imports EnvDTE80
Imports Microsoft.VisualBasic

Public Class C
    Implements VisualCommanderExt.ICommand

    Sub Run(DTE As EnvDTE80.DTE2, package As Microsoft.VisualStudio.Shell.Package) Implements VisualCommanderExt.ICommand.Run
        DTE.ExecuteCommand("File.SaveAll")
        DTE.ExecuteCommand("Tools.ExternalCommand6" )
    End Sub
End Class

This macro can now be added to a tool bar or keyboard shortcut instead of running the external tool directly.

like image 37
Randy Bones Avatar answered Sep 27 '22 22:09

Randy Bones