0

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 ...).

Kasrak
  • 1,509
  • 4
  • 24
  • 48

1 Answers1

1

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);
Sergey Vlasov
  • 26,641
  • 3
  • 64
  • 66
  • Nice +1, not sure how can I assign a shortcut then, will check the tool and the document. – Kasrak Apr 27 '21 at 08:48
  • Hello again Mr Vlaslov, I created another question: https://stackoverflow.com/q/68325886/132239 which if you be interested, I like to know if your extension can help, (which I think so), or not? Thanks if you have a look and help me with that. – Kasrak Jul 10 '21 at 11:44