Runar Ovesen Hjerpbakk

Programmer. Software Architect. Technical Manager.

Don’t commit launch.json

You’ll remember that I recently experienced a snag while working on the same dotnet script script(!?!) on two different machines. During the project, I updated dotnet script on one machine but forgot to do it on the other. I wrote in my post that the solution was just to remember to upgrade on all machines, but Bernhard recommended a better solution.

Don’t commit launch.json!

Visual Studio Code keeps debugging configuration information in a launch.json file located in a .vscode folder in your workspace (project root folder). This file enables debugging of dotnet script and is created together with main.csx if you run dotnet script init in an empty folder.

But as my previous post shows, this file can become out of sync with the local installation. The path to the dotnet script installation contains the version number.

The solution is that running dotnet script init in a folder already containing main.csx but missing launch.json will create a launch.json file tailored to your local installation of dotnet script. Thus you don’t need to commit this file to source control and each machine can be upgraded when convenient.

launch.json contains the dotnet script version number in its path