0

In Visual Studio in Windows I can create a launchSettings.json profile which starts up an executable I specify and then attaches to it. Is it possible to do the same with an executable in WSL?

I'm writing an extension to a Linux program. The extension is a .Net 6 class library, so in order to debug it I need to start up the Linux program and then immediately attach. I could start up the program manually and then attach to the process from Visual Studio, but the extension loads first thing and I can't hop over to Visual Studio and attach fast enough to catch it.

I've found instructions for debugging .Net ASP and console apps in WSL from Visual Studio, but those instructions always assume that the project I'm debugging is itself executable.

Trygve
  • 591
  • 1
  • 7
  • 22

1 Answers1

0

The section WSL settings in the launch profile details the options for the launch profile. You can use executablePath and commandLineArgs to change what VS launches for debugging.

  • ah cool, that looks promising. When I try that though, I get an error popup: "The project doesn't know how to run the profile with name '...' and command 'WSL'." The json schema also flags my commandName of "WSL". – Trygve Mar 14 '23 at 20:48