Is there any way to run PowerShell snippet in Package Manager Console as a VS 2022 'macro'?

49 Views Asked by At

Context

I have many PowerShell snippets, what I am using in VS 2022 PM> console, for example something like this:

#... some lines here
$dte.ExecuteCommand("Tools.ImportandExportSettings", '/export:'+$filenameEscaped)
#... some lines here

Currently I use this a pretty inconvenient, and productivity killer way:

  • I look for the text file which contains the code lines either in file system, either in the project (in case it contains it)
  • copy the lines to the clipboard
  • open the PM> window
  • paste the code on the clipboard.

Question

The productive way would be, just pressing a keyboard shortcut... Is there any way to achieve this?

0

There are 0 best solutions below