Skip to content

Commit

Permalink
updated the launch.json to use config env var
Browse files Browse the repository at this point in the history
  • Loading branch information
solomiofactura committed Sep 26, 2024
1 parent 2d320b8 commit f1370a4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"features": {
"ghcr.io/devcontainers/features/powershell:1": {}
},
"postCreateCommand": "cd /workspaces/PersistedAssemblyBuilder.ConsoleApp/.devcontainer/ && sudo chmod +x initializebashfiles.sh && ./initializebashfiles.sh",
"postCreateCommand": "cd /workspaces/PersistedAssemblyBuilder.ConsoleApp/.devcontainer/ && sudo chmod +x initializebashfiles.sh && sudo chmod +x run-program.sh && ./initializebashfiles.sh",
"postStartCommand": ""
}
11 changes: 11 additions & 0 deletions .devcontainer/run-program.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Check if the Configuration variable is set
if [ -z "$Configuration" ]; then
echo "Error: Configuration environment variable is not set."
exit 1
fi

# Run the .NET application with the specified Configuration
dotnet build "${workspaceFolder}/PersistedAssemblyBuilder.ConsoleApp/PersistedAssemblyBuilder.ConsoleApp.csproj" --configuration "$Configuration"
dotnet "${workspaceFolder}/PersistedAssemblyBuilder.ConsoleApp/bin/$Configuration/net9.0/PersistedAssemblyBuilder.ConsoleApp.dll"
12 changes: 6 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"name": ".NET 9 Launch (console)",
"type": "coreclr",
"request": "launch",
// "preLaunchTask": "build",
"program": "${workspaceFolder}/PersistedAssemblyBuilder.ConsoleApp/bin/${env:Configuration}/net9.0/PersistedAssemblyBuilder.ConsoleApp.dll",
"args": [],
"program": "bash",
"args": [
"${workspaceFolder}/.vscode/run-program.sh" // Only call the script without additional args
],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole",
"internalConsoleOptions": "openOnSessionStart",
"brokeredServicePipeName": "undefined"
"console": "integratedTerminal",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

0 comments on commit f1370a4

Please sign in to comment.