Fix dev launches passing the script file instead of the app directory

Point the unpackaged dev launches at the .electron directory rather than
main.js, so Electron reads package.json as the app manifest and resolves
the app name and the default userData folder from productName at process
startup, instead of falling back to the default app's "Electron" name.
Covers the .NET-first branch in ElectronProcessActive and the
Electron-first launches (launchSettings and docs).
This commit is contained in:
Denny09310
2026-10-22 08:42:04 +02:00
parent 2ec22921bd
commit 255e3cf50f
6 changed files with 13 additions and 7 deletions

View File

@@ -40,7 +40,7 @@ Debug the Electron process when you need to inspect native Electron APIs:
"Electron (unpackaged)": {
"commandName": "Executable",
"executablePath": "node",
"commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron",
"commandLineArgs": "node_modules/electron/cli.js . -unpackedelectron",
"workingDirectory": "$(TargetDir).electron",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
@@ -99,7 +99,7 @@ Add the debugging profiles to `Properties/launchSettings.json`:
"Electron (unpackaged)": {
"commandName": "Executable",
"executablePath": "node",
"commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron",
"commandLineArgs": "node_modules/electron/cli.js . -unpackedelectron",
"workingDirectory": "$(TargetDir).electron",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"

View File

@@ -17,7 +17,9 @@ The framework supports **8 different launch scenarios** covering every combinati
#### **`-unpackedelectron`** - Electron-first debugging
```bash
# Launch Electron first, which then starts .NET
node node_modules/electron/cli.js main.js -unpackedelectron
# ('.' = the .electron dir: Electron then reads its package.json as the app manifest,
# so the app name and userData folder resolve correctly instead of defaulting to "Electron")
node node_modules/electron/cli.js . -unpackedelectron
```
#### **`-unpackeddotnet`** - .NET-first debugging
@@ -146,7 +148,7 @@ The image above illustrates how each combination of deployment type, application
"Electron (unpackaged)": {
"commandName": "Executable",
"executablePath": "node",
"commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron"
"commandLineArgs": "node_modules/electron/cli.js . -unpackedelectron"
}
}
```