Delete a specific file with a shortcut key

49 views Asked by At

Is there a way to delete a specific file or 2 files with a shortcut key in Visual Studio? The path is will be a dynamic path of the current selected/active project.

That is no matter for me to use a 3rd party tool, macros, extensions, batch files, CodeRush or whatever (using some other Windows apps or ...).

1

There are 1 answers

2
Sergey Vlasov On BEST ANSWER

You can create a command and assign a shortcut to it with my Visual Commander extension.

In the command, to get the project path for the active document window:

string projectFile=DTE.ActiveDocument.ProjectItem.ContainingProject.FileName;

To delete a file:

System.IO.File.Delete(path);