feat(run): .NET project run and debug configurations (#686)

.NET projects had no run configurations.

Projects from .csproj files (and those listed in .sln/.slnx) now get configurations: executable projects (OutputType Exe/WinExe, or the Web SDK) get a .NET Project configuration running dotnet run, one per Project launch profile in Properties/launchSettings.json with its application URL and environment shown; test projects (Microsoft.NET.Test.Sdk) get dotnet test. The form edits project, target framework, launch profile, program arguments and environment, which override the profile's values. Debug builds the project, resolves the output assembly through MSBuild and launches it under netcoredbg, offering to install netcoredbg when missing. The source-text catalog test now ignores Rust character literals when collecting backend strings.

Part of #615
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-01 19:34:31 +08:00
1 джерело b5dbd3c020
коміт 245fe3cdf4
22 files changed
+908 -6

No files matched your search

+20
Переглянути файл
@@ -321,3 +321,23 @@ describe("Go build configuration fields", () => {
});
});
});
it("netcoredbg launches the evaluated DLL with resolved profile arguments, env and cwd", () => {
const c = rc({
kind: "dotnet",
command: "dotnet",
debugAdapter: "netcoredbg",
cwd: "/repo/work",
env: { ASPNETCORE_URLS: "http://localhost:5165", DEMO: "override" },
params: { targetPath: "/repo/custom/Renamed.dll", programArgs: "--name 'hello world'", profileArgs: "--profile" },
});
expect(launchConfigFor(c, "/repo")).toMatchObject({
adapter: "netcoredbg",
program: "/repo/custom/Renamed.dll",
args: ["--name", "hello world"],
cwd: "/repo/work",
env: c.env,
});
expect(launchConfigFor({ ...c, params: { ...c.params, programArgs: "" } }, "/repo")?.args).toEqual(["--profile"]);
expect(launchConfigFor({ ...c, params: {} }, "/repo")).toBeNull();
});
+3
Переглянути файл
@@ -21,6 +21,9 @@ describe("missing debug adapters", () => {
expect(
missingAdapter("kotlin-debug-adapter", unavailable("debug adapter `kotlin-debug-adapter` not found (x)"))?.tool,
).toBe("kotlin-debug-adapter");
expect(missingAdapter("netcoredbg", unavailable("debug adapter `netcoredbg` not found (x)"))?.tool).toBe(
"netcoredbg",
);
expect(missingAdapter("delve", unavailable("debug adapter `delve` not found (x)"))?.tool).toBe("delve");
});
+3 -1
Переглянути файл
@@ -297,7 +297,9 @@ async function startConfig(arg: unknown) {
await startJavaConfig(config, root, origin ?? config);
return;
}
const launch = launchConfigFor(config, root);
const dotnet = config.kind === "dotnet" && config.debugAdapter === "netcoredbg";
const prepared = dotnet ? await call(commands.runDotnetResolve(config, true)) : config;
const launch = launchConfigFor(prepared, root);
if (!launch) {
notifications().notify({
group: "run",
+9
Переглянути файл
@@ -313,6 +313,15 @@ export function launchConfigFor(rc: RunConfig, root: string): LaunchConfig | nul
if (adapter === "js-debug") return jsDebugLaunch(rc, cwd);
if (adapter === "delve") return delveLaunch(rc, cwd, root);
if (adapter === "godot") return godotLaunch(rc, cwd);
if (adapter === "netcoredbg" && rc.kind === "dotnet") {
if (!rc.params?.targetPath) return null;
return {
...base(rc, adapter, cwd),
program: rc.params.targetPath,
args: parseArgs(rc.params.programArgs?.trim() ? rc.params.programArgs : rc.params.profileArgs || ""),
extraJson: JSON.stringify({ justMyCode: workflowSettings().debugger.skipLibraryCode }),
};
}
// Adapters without a template (hidden in Edit Configurations): generic arguments.
return {
...base(rc, adapter, cwd),
+1
Переглянути файл
@@ -7,6 +7,7 @@ import { IpcError } from "@/platform/ipc";
/** Adapters the tools installer can provide (adapter id → tool name). */
const INSTALLABLE: Record<string, { tool: string; title: string }> = {
"kotlin-debug-adapter": { tool: "kotlin-debug-adapter", title: "The Kotlin debugger is not installed" },
netcoredbg: { tool: "netcoredbg", title: "netcoredbg is not installed" },
debugpy: { tool: "debugpy", title: "debugpy is not installed" },
"js-debug": { tool: "js-debug", title: "The JavaScript debugger (vscode-js-debug) is not installed" },
delve: { tool: "delve", title: "Delve is not installed" },