From 19265b36c284976626d57199ed1b66f99e103a19 Mon Sep 17 00:00:00 2001 From: Alberto Balbo Date: Thu, 15 Oct 2026 14:53:12 +0200 Subject: [PATCH] build: debug the Windows programs from VS Code F5 in VS Code now starts Titano, the Uploader and the server under the C# extension's debugger, as well as the --capture runs, Titano.Tools and the test programs. Each configuration builds in Debug first and starts the program's .exe rather than its .dll, because the programs read Environment.ProcessPath (Setup's payload, the Run keys and tray icons). The server's session keeps its data and archive in out/debug/server instead of %ProgramData% and C:\TitanoArchive. The build tasks use no reused MSBuild nodes, whose cached drive-letter case made every F5 build restore and C# Dev Kit reload, and keep MSB3026 (a copy that succeeds on a retry) a warning so a file held for a moment no longer stops F5. Design-time builds skip the icon generation, which on a fresh clone ran a Titano.Tools.dll that did not exist yet (MSB3073 in VS Code), and log WPF's MC1000 about projects not built yet as a message. Co-Authored-By: Claude Opus 5.5 --- .vscode/extensions.json | 4 + .vscode/launch.json | 188 ++++++++++++++++++++++++++++++++++++++++ .vscode/tasks.json | 128 +++++++++++++++++++++++++++ Directory.Build.props | 6 ++ Directory.Build.targets | 4 +- README.md | 28 ++++++ docs/CHANGELOG.md | 6 ++ docs/DECISIONS.md | 2 + 8 files changed, 365 insertions(+), 1 deletion(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..b699e619 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + // The coreclr debugger of launch.json comes with the C# extension. + "recommendations": ["ms-dotnettools.csharp"] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..57fcc9b5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,188 @@ +{ + // Windows programs under the C# extension's debugger. Each launch configuration builds in Debug first (tasks.json), + // then starts the program's .exe, never "dotnet .dll": the programs read Environment.ProcessPath (the Run + // keys and tray icons of Titano and the Uploader, Setup's payload and the stub of its capture's sample installer). + "version": "0.2.0", + "configurations": [ + { + "name": "Titano", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build: Titano", + "program": "${workspaceFolder}/src/Titano.App/bin/Debug/net10.0-windows/Titano.exe", + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "presentation": { + "group": "1-programs", + "order": 1 + } + }, + { + "name": "Titano Uploader", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build: Titano Uploader", + "program": "${workspaceFolder}/src/Titano.Uploader/bin/Debug/net10.0-windows/Titano.Uploader.exe", + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "presentation": { + "group": "1-programs", + "order": 2 + } + }, + { + // SQLite, as on any Windows server, with the data and the archive in out/debug/server instead of + // %ProgramData%\Titano Server and C:\TitanoArchive. The first administrator's temporary password is in + // out/debug/server/data/initial-admin-password.txt. + "name": "Titano Server", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build: Titano Server", + "program": "${workspaceFolder}/src/Titano.Server/bin/Debug/net10.0/Titano.Server.exe", + "cwd": "${workspaceFolder}", + "env": { + "TITANO_DATA_PATH": "${workspaceFolder}\\out\\debug\\server\\data", + "TITANO_ARCHIVE_PATH": "${workspaceFolder}\\out\\debug\\server\\archive" + }, + "console": "internalConsole", + "serverReadyAction": { + "action": "openExternally", + "pattern": "Now listening on: https://\\S+:(\\d+)", + "uriFormat": "https://localhost:%s/admin/" + }, + // The server makes its own certificate (data\tls); the ASP.NET Core development certificate plays no part. + "checkForDevCert": false, + "presentation": { + "group": "1-programs", + "order": 3 + } + }, + { + // Every screen with sample data in a throw-away data folder, as the CI screenshots step runs it. + "name": "Titano (screenshots)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build: Titano", + "program": "${workspaceFolder}/src/Titano.App/bin/Debug/net10.0-windows/Titano.exe", + "args": ["--capture", "${workspaceFolder}\\out\\screenshots"], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "presentation": { + "group": "2-screenshots", + "order": 1 + } + }, + { + "name": "Titano Uploader (screenshots)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build: Titano Uploader", + "program": "${workspaceFolder}/src/Titano.Uploader/bin/Debug/net10.0-windows/Titano.Uploader.exe", + "args": ["--capture", "${workspaceFolder}\\out\\screenshots"], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "presentation": { + "group": "2-screenshots", + "order": 2 + } + }, + { + // Setup has no payload outside a packed installer: the capture builds a sample one and installs nothing. + "name": "Titano Setup (screenshots)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build: Titano Setup", + "program": "${workspaceFolder}/src/Titano.Setup/bin/Debug/net10.0-windows/Titano.Setup.exe", + "args": ["--capture", "${workspaceFolder}\\out\\screenshots"], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "presentation": { + "group": "2-screenshots", + "order": 3 + } + }, + { + "name": "Titano.Tools", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build: Titano.Tools", + "program": "${workspaceFolder}/src/Titano.Tools/bin/Debug/net10.0/Titano.Tools.exe", + "args": "${input:toolsArguments}", + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "presentation": { + "group": "3-development", + "order": 1 + } + }, + { + "name": "Tests", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/tests/${input:testProgram}", + "args": "${input:testArguments}", + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "presentation": { + "group": "3-development", + "order": 2 + } + }, + { + "name": "Attach to process", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}", + "presentation": { + "group": "3-development", + "order": 3 + } + } + ], + "inputs": [ + { + "id": "toolsArguments", + "type": "promptString", + "description": "Titano.Tools command and options (--help lists them; changelog needs --in here)", + "default": "i18n check" + }, + { + "id": "testProgram", + "type": "pickString", + "description": "Test program", + "options": [ + { + "label": "Titano.Core.Tests", + "value": "Titano.Core.Tests/bin/Debug/net10.0/Titano.Core.Tests.exe" + }, + { + "label": "Titano.Core.Windows.Tests", + "value": "Titano.Core.Windows.Tests/bin/Debug/net10.0-windows/Titano.Core.Windows.Tests.exe" + }, + { + "label": "Titano.Data.Tests", + "value": "Titano.Data.Tests/bin/Debug/net10.0/Titano.Data.Tests.exe" + }, + { + "label": "Titano.Server.Tests", + "value": "Titano.Server.Tests/bin/Debug/net10.0/Titano.Server.Tests.exe" + }, + { + "label": "Titano.App.Tests", + "value": "Titano.App.Tests/bin/Debug/net10.0-windows/Titano.App.Tests.exe" + }, + { + "label": "Titano.Tools.Tests", + "value": "Titano.Tools.Tests/bin/Debug/net10.0/Titano.Tools.Tests.exe" + } + ] + }, + { + "id": "testArguments", + "type": "promptString", + "description": "Options: --filter , --exclude , --parallel , --list, --verbose", + "default": "--parallel 1" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..54d69e5b --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,128 @@ +{ + // Debug builds for the configurations in launch.json. The classic console logger (no terminal logger, full paths, + // no wrapping) prints each diagnostic on one line for the $msCompile problem matcher. No reused MSBuild nodes: they + // keep the drive letter's case of earlier builds (VS Code passes it in lower case), and the mixed-case restores + // they caused made every build restore and C# Dev Kit reload. A copy that succeeds on a retry (MSB3026: a file held + // for a moment by an antivirus or another build) does not fail the build; one that never succeeds still does + // (MSB3027). + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "detail": "Titano.slnx, Debug", + "type": "process", + "command": "dotnet", + "args": [ + "build", + "${workspaceFolder}/Titano.slnx", + "-c", + "Debug", + "-tl:off", + "-nodeReuse:false", + "-p:GenerateFullPaths=true", + "-p:MSBuildWarningsNotAsErrors=MSB3026", + "-consoleLoggerParameters:ForceNoAlign" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": "$msCompile" + }, + { + "label": "build: Titano", + "detail": "src/Titano.App, Debug", + "type": "process", + "command": "dotnet", + "args": [ + "build", + "${workspaceFolder}/src/Titano.App/Titano.App.csproj", + "-c", + "Debug", + "-tl:off", + "-nodeReuse:false", + "-p:GenerateFullPaths=true", + "-p:MSBuildWarningsNotAsErrors=MSB3026", + "-consoleLoggerParameters:ForceNoAlign" + ], + "group": "build", + "problemMatcher": "$msCompile" + }, + { + "label": "build: Titano Uploader", + "detail": "src/Titano.Uploader, Debug", + "type": "process", + "command": "dotnet", + "args": [ + "build", + "${workspaceFolder}/src/Titano.Uploader/Titano.Uploader.csproj", + "-c", + "Debug", + "-tl:off", + "-nodeReuse:false", + "-p:GenerateFullPaths=true", + "-p:MSBuildWarningsNotAsErrors=MSB3026", + "-consoleLoggerParameters:ForceNoAlign" + ], + "group": "build", + "problemMatcher": "$msCompile" + }, + { + "label": "build: Titano Server", + "detail": "src/Titano.Server, Debug", + "type": "process", + "command": "dotnet", + "args": [ + "build", + "${workspaceFolder}/src/Titano.Server/Titano.Server.csproj", + "-c", + "Debug", + "-tl:off", + "-nodeReuse:false", + "-p:GenerateFullPaths=true", + "-p:MSBuildWarningsNotAsErrors=MSB3026", + "-consoleLoggerParameters:ForceNoAlign" + ], + "group": "build", + "problemMatcher": "$msCompile" + }, + { + "label": "build: Titano Setup", + "detail": "src/Titano.Setup, Debug", + "type": "process", + "command": "dotnet", + "args": [ + "build", + "${workspaceFolder}/src/Titano.Setup/Titano.Setup.csproj", + "-c", + "Debug", + "-tl:off", + "-nodeReuse:false", + "-p:GenerateFullPaths=true", + "-p:MSBuildWarningsNotAsErrors=MSB3026", + "-consoleLoggerParameters:ForceNoAlign" + ], + "group": "build", + "problemMatcher": "$msCompile" + }, + { + "label": "build: Titano.Tools", + "detail": "src/Titano.Tools, Debug", + "type": "process", + "command": "dotnet", + "args": [ + "build", + "${workspaceFolder}/src/Titano.Tools/Titano.Tools.csproj", + "-c", + "Debug", + "-tl:off", + "-nodeReuse:false", + "-p:GenerateFullPaths=true", + "-p:MSBuildWarningsNotAsErrors=MSB3026", + "-consoleLoggerParameters:ForceNoAlign" + ], + "group": "build", + "problemMatcher": "$msCompile" + } + ] +} diff --git a/Directory.Build.props b/Directory.Build.props index c0c906ca..c08b3f1e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -35,6 +35,12 @@ embedded + + + $(MSBuildWarningsAsMessages);MC1000 + + alby96/titano-releases diff --git a/Directory.Build.targets b/Directory.Build.targets index 60f0cca3..6e2913f9 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -27,8 +27,10 @@ GlobalPropertiesToRemove="RuntimeIdentifier;SelfContained;PublishSingleFile;PublishReadyToRun;TargetFramework" Private="false" /> + .dll`; the server's default folders; ports of its own for the server; a portable copy (`portable.txt`) for the desktop programs; reused MSBuild nodes; MSB3026 as an error | The `coreclr` debugger needs only the C# extension. Started as a `.dll`, the process is `dotnet.exe`, which the programs read as their own path (`Environment.ProcessPath`): Setup's payload and the stub of its capture's sample installer, the Run keys and tray icons. A console run creates `%ProgramData%\Titano Server` owned by the developer, which the service then refuses (the console-run data folder rows), and `C:\TitanoArchive` at the drive root. On the default ports the clients reach the debug server as they reach an installed one; the README says to stop the Docker stack or an installed server first. A portable copy would run other code than an installed one (data beside the program, the portable update download). MSB3026 reports a copy that a retry then completes (a file held for a moment by an antivirus or another build): as an error it stopped F5 although the build succeeded, while a copy that never succeeds still fails (MSB3027). Reused MSBuild nodes keep the drive letter's case of the build that started them, while VS Code passes it in lower case: restores mixed both cases, rewrote `project.assets.json` at every build and made C# Dev Kit reload the projects, so no F5 build was a no-op (7 to 14 s for Titano instead of about 5 s). | +| 2026-10-15 | Design-time builds (`DesignTimeBuild=true`: C# Dev Kit, Visual Studio) skip the `TitanoGenerateIcons` target (`Directory.Build.targets`) and log WPF's MC1000 as a message (`Directory.Build.props`). Refines 2026-10-02 'Program icons (ICO) are generated at build time…'. | Build `Titano.Tools` from the design-time build; no warnings as errors in design-time builds; leave it | A design-time build builds no project references, so on a fresh clone `make-icon` ran a `Titano.Tools.dll` that did not exist yet: VS Code listed MSB3073 for Titano, the Uploader and Setup when the folder opened. A design-time build compiles nothing, so it needs no icon. Past that target, the markup compile of their XAML cannot load `Titano.Ui.dll` before the first build: MC1000, which the design-time build makes a warning and warnings as errors made an error again (21 of them). Without warnings as errors they would still be listed, as warnings. Real builds still fail on MC1000. |