PowerShell/PowerShellStandard

dotnet new template psmodule - launchSettings.json / debug profiles

espenrl opened this issue · 3 comments

In .NET automation libraries I find these profiles convenient for debugging. Maybe others might find them useful.

Only works for Visual Studio though. A drawback is hard coded paths to PowerShell Core executables.

{
  "profiles": {
    "PowerShell Core x64": {
      "commandName": "Executable",
      "executablePath": "C:\\Program Files\\PowerShell\\6.0.1\\pwsh.exe",
      "commandLineArgs": "-NoExit -Command \"Import-Module '$(TargetPath)'\""
    },
    "PowerShell Core x86": {
      "commandName": "Executable",
      "executablePath": "C:\\Program Files (x86)\\PowerShell\\6.0.1\\pwsh.exe",
      "commandLineArgs": "-NoExit -Command \"Import-Module '$(TargetPath)'\""
    },
    "PowerShell Desktop x64": {
      "commandName": "Executable",
      "executablePath": "%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe",
      "commandLineArgs": "-NoExit -ExecutionPolicy ByPass -Command \"Import-Module '$(TargetPath)'\""
    },
    "PowerShell Desktop x86": {
      "commandName": "Executable",
      "executablePath": "%SystemRoot%\\syswow64\\WindowsPowerShell\\v1.0\\powershell.exe",
      "commandLineArgs": "-NoExit -ExecutionPolicy ByPass -Command \"Import-Module '$(TargetPath)'\""
    }
  }
}

I think it would be nice to have something like this - but I also want it to be generic enough. Also, not everyone uses Visual Studio so we'd want some switch to specify what text editor you're looking to use.

If I want Visual Studio, I get this. If I want VSCode, I should get a launch.json.. etc.

If I want Visual Studio, I get this. If I want VSCode, I should get a launch.json.. etc.

How about just including the launch config for all the supported editors?

We could also do that! I know that repos tend to include config files for multiple editors.