Skip to content
| Marketplace
Sign in
Visual Studio>Tools>RunOnSave
RunOnSave

RunOnSave

Will Fuqua

|
650 installs
| (1) | Free
A Visual Studio extension that can run commands on files when they're saved. Configured using an .onsaveconfig file, which can be checked into version control.
Download

A simple Visual Studio extension that runs a command (i.e. a command line application), whenever a file is saved in Visual Studio.

The command to be run is specified in a .onsaveconfig file, which has the same syntax and behavior as .editorconfig files.

Here's an example .onsaveconfig file that calls dotnet-csharpier on C# files:

# run dotnet csharpier on C# files, whenever they're saved.
[*.cs]
command = dotnet
arguments = csharpier {file}

The following options are supported:

  • command - the command to run. It should be either fully qualified or available on the Path environment variable. For .cmd and .bat files, make sure the file extension is included in the command.
    • {solution_directory} - The directory of the solution file (e.g. C:\MySolution)
  • arguments - the arguments to supply to the command. It supports the following placeholders:
    • {file} - The fully qualifed file that was saved (e.g. C:\Foo\Bar.cs)
    • {filename} - The file name only (e.g. Bar.cs)
    • {directory} - The directory only (e.g. C:\Foo)
  • working_directory - The working directory to run the command in. Defaults to the directory of the file that was saved.
  • timeout_seconds - How long to wait for the command to finish. Defaults to 30 seconds.

Similar to .editorconfig, specific files can be ignored by setting the command to unset or ignore:

[*.cs]
command = dotnet
arguments = csharpier {file}

[BigFile.cs]
command = ignore

Logo by icons8.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft