Per-project launch options, publish/test tasks, explorer badge, keybindings

- dotnetSolution.launch.projects: args, env, cwd, console and profile
  per project name, layered over the global settings and
  Properties/launchSettings.json. Applied to the debug button and,
  through resolveDebugConfiguration, to the launch.json entry too.
- publish and test task targets with the same configuration/platform.
- Problems panel opens when a task fails.
- The startup csproj and its folder are marked in the explorer.
- F5 / Ctrl+F5 / Ctrl+Shift+B map to debug/run/build until a launch.json
  entry exists; Ctrl+Alt+C and Ctrl+Alt+P open the pickers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169iPWwKHZoBTNN9qwXiwqk
This commit is contained in:
max
2026-09-08 13:33:12 +02:00
co-authored by Claude Fable 5.1
parent a01a94f1a4
commit 0300dfa42f
7 changed files with 504 additions and 68 deletions
+209 -24
View File
@@ -28,18 +28,81 @@
"main": "./out/extension.js",
"contributes": {
"commands": [
{ "command": "dotnetSolution.selectStartupProject", "title": "Select Startup Project", "category": ".NET Solution" },
{ "command": "dotnetSolution.selectConfiguration", "title": "Select Configuration", "category": ".NET Solution" },
{ "command": "dotnetSolution.selectSolution", "title": "Select Solution", "category": ".NET Solution" },
{ "command": "dotnetSolution.build", "title": "Build", "category": ".NET Solution", "icon": "$(tools)" },
{ "command": "dotnetSolution.rebuild", "title": "Rebuild", "category": ".NET Solution" },
{ "command": "dotnetSolution.clean", "title": "Clean", "category": ".NET Solution" },
{ "command": "dotnetSolution.debug", "title": "Debug Startup Project", "category": ".NET Solution", "icon": "$(debug-alt)" },
{ "command": "dotnetSolution.run", "title": "Run Startup Project (without debugging)", "category": ".NET Solution", "icon": "$(play)" },
{ "command": "dotnetSolution.generateLaunchConfig", "title": "Create launch.json and tasks.json entries", "category": ".NET Solution" },
{ "command": "dotnetSolution.reload", "title": "Reload Solution", "category": ".NET Solution" },
{ "command": "dotnetSolution.showOutput", "title": "Show Log", "category": ".NET Solution" },
{ "command": "dotnetSolution.setStartupProject", "title": "Set as Startup Project (.NET Solution)", "category": ".NET Solution" }
{
"command": "dotnetSolution.selectStartupProject",
"title": "Select Startup Project",
"category": ".NET Solution"
},
{
"command": "dotnetSolution.selectConfiguration",
"title": "Select Configuration",
"category": ".NET Solution"
},
{
"command": "dotnetSolution.selectSolution",
"title": "Select Solution",
"category": ".NET Solution"
},
{
"command": "dotnetSolution.build",
"title": "Build",
"category": ".NET Solution",
"icon": "$(tools)"
},
{
"command": "dotnetSolution.rebuild",
"title": "Rebuild",
"category": ".NET Solution"
},
{
"command": "dotnetSolution.clean",
"title": "Clean",
"category": ".NET Solution"
},
{
"command": "dotnetSolution.publish",
"title": "Publish Startup Project",
"category": ".NET Solution",
"icon": "$(package)"
},
{
"command": "dotnetSolution.test",
"title": "Run Tests",
"category": ".NET Solution",
"icon": "$(beaker)"
},
{
"command": "dotnetSolution.debug",
"title": "Debug Startup Project",
"category": ".NET Solution",
"icon": "$(debug-alt)"
},
{
"command": "dotnetSolution.run",
"title": "Run Startup Project (without debugging)",
"category": ".NET Solution",
"icon": "$(play)"
},
{
"command": "dotnetSolution.generateLaunchConfig",
"title": "Create launch.json and tasks.json entries",
"category": ".NET Solution"
},
{
"command": "dotnetSolution.reload",
"title": "Reload Solution",
"category": ".NET Solution"
},
{
"command": "dotnetSolution.showOutput",
"title": "Show Log",
"category": ".NET Solution"
},
{
"command": "dotnetSolution.setStartupProject",
"title": "Set as Startup Project (.NET Solution)",
"category": ".NET Solution"
}
],
"menus": {
"explorer/context": [
@@ -50,7 +113,10 @@
}
],
"commandPalette": [
{ "command": "dotnetSolution.setStartupProject", "when": "false" }
{
"command": "dotnetSolution.setStartupProject",
"when": "false"
}
]
},
"taskDefinitions": [
@@ -60,18 +126,29 @@
"properties": {
"target": {
"type": "string",
"enum": ["build", "rebuild", "clean"],
"enum": [
"build",
"rebuild",
"clean",
"publish",
"test"
],
"default": "build",
"description": "What to do. Defaults to build."
"description": "What to do. Publish always targets the startup project; test runs the solution or project depending on scope."
},
"scope": {
"type": "string",
"enum": ["solution", "project"],
"enum": [
"solution",
"project"
],
"description": "Build the whole solution with the selected solution configuration, or only the startup project with the project configuration the solution maps it to. Defaults to the dotnetSolution.buildScope setting."
},
"args": {
"type": "array",
"items": { "type": "string" },
"items": {
"type": "string"
},
"description": "Extra arguments appended to the dotnet command."
}
}
@@ -88,7 +165,10 @@
},
"dotnetSolution.buildScope": {
"type": "string",
"enum": ["solution", "project"],
"enum": [
"solution",
"project"
],
"enumDescriptions": [
"dotnet build <solution> -c <Configuration> -p:Platform=<Platform>. Honours solution-level project dependencies and per-project configuration mapping, like Visual Studio's Build Solution.",
"dotnet build <startup project> with the configuration and platform the solution maps it to. Faster, but ignores dependencies that only exist in the .sln (ProjectDependencies)."
@@ -103,24 +183,32 @@
},
"dotnetSolution.launch.args": {
"type": "array",
"items": { "type": "string" },
"items": {
"type": "string"
},
"default": [],
"description": "Arguments passed to the startup project when launched from this extension."
},
"dotnetSolution.launch.env": {
"type": "object",
"additionalProperties": { "type": "string" },
"additionalProperties": {
"type": "string"
},
"default": {},
"description": "Environment variables for the launched startup project."
},
"dotnetSolution.launch.cwd": {
"type": "string",
"default": "",
"description": "Working directory for the launched startup project. Empty uses the output directory (TargetDir)."
"description": "Working directory for the launched startup project, relative to the project folder. Empty uses launchSettings.json or the output directory (TargetDir)."
},
"dotnetSolution.launch.console": {
"type": "string",
"enum": ["internalConsole", "integratedTerminal", "externalTerminal"],
"enum": [
"internalConsole",
"integratedTerminal",
"externalTerminal"
],
"default": "internalConsole",
"description": "Console for the debugged application."
},
@@ -141,12 +229,109 @@
},
"dotnetSolution.additionalBuildArguments": {
"type": "array",
"items": { "type": "string" },
"items": {
"type": "string"
},
"default": [],
"description": "Extra arguments for every dotnet build / clean run by this extension."
},
"dotnetSolution.launch.projects": {
"type": "object",
"default": {},
"markdownDescription": "Per-project launch options, keyed by project name. Each entry may set `args`, `env`, `cwd` (relative to the project folder), `console` and `profile` (a launchSettings.json profile name). These override the global `dotnetSolution.launch.*` settings and `Properties/launchSettings.json`.\n\nExample: `{ \"Nerfed.Builder\": { \"args\": [\"-build\"], \"cwd\": \"../Bin/Nerfed.Builder\" } }`",
"additionalProperties": {
"type": "object",
"properties": {
"args": {
"type": "array",
"items": {
"type": "string"
}
},
"env": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"cwd": {
"type": "string"
},
"console": {
"type": "string",
"enum": [
"internalConsole",
"integratedTerminal",
"externalTerminal"
]
},
"profile": {
"type": "string"
}
}
}
},
"dotnetSolution.launch.profile": {
"type": "string",
"default": "",
"description": "Profile to take from Properties/launchSettings.json. Empty picks the first profile with commandName \"Project\"."
},
"dotnetSolution.publish.runtime": {
"type": "string",
"default": "",
"description": "Runtime identifier for dotnet publish, e.g. win-x64. Required for PublishAot. Empty omits -r."
},
"dotnetSolution.publish.args": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Extra arguments for dotnet publish, e.g. [\"--self-contained\"]."
},
"dotnetSolution.test.args": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Extra arguments for dotnet test, e.g. [\"--no-build\"] or a filter."
},
"dotnetSolution.showProblemsOnFailure": {
"type": "boolean",
"default": true,
"description": "Open the Problems panel when a build, publish or test run fails."
}
}
}
},
"keybindings": [
{
"command": "dotnetSolution.build",
"key": "ctrl+shift+b",
"mac": "cmd+shift+b",
"when": "dotnetSolution.active && !dotnetSolution.hasLaunchEntry"
},
{
"command": "dotnetSolution.debug",
"key": "f5",
"when": "dotnetSolution.active && !inDebugMode && !dotnetSolution.hasLaunchEntry && !terminalFocus"
},
{
"command": "dotnetSolution.run",
"key": "ctrl+f5",
"when": "dotnetSolution.active && !inDebugMode && !dotnetSolution.hasLaunchEntry"
},
{
"command": "dotnetSolution.selectConfiguration",
"key": "ctrl+alt+c",
"when": "dotnetSolution.active"
},
{
"command": "dotnetSolution.selectStartupProject",
"key": "ctrl+alt+p",
"when": "dotnetSolution.active"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",