Run external tool before save in Visual Studio

Sachelis 21 Reputation points

I have an External Tool in Visual Studio (not Code) that I can run from the Tools menu. Is it possible to have this tool run automatically before a file is saved (on a per-project basis)?


Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,693 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sergey Vlasov 266 Reputation points

    You can run a tool after the file is saved like this:

    There is no similar event before the file is saved and the tool wouldn't be able to access the file content as it is not yet saved.

    You may also look at single-file generators that can transform a single input file into a single output file whenever the file is saved:

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,406 Reputation points

    Hi Sachelis,

    Currently, VS IDE does not support extending Save commands and automatically running external tools.

    Best Regards, Dylan

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**

    0 comments No comments