diff --git a/Changelog.md b/Changelog.md index 14c4706..6f97b88 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ - Fixed resolution of unrelated target (#1099) @epsnm - Added target framework customization (#1095) @epsnm - Added configurable Electron root directory for custom packaging layouts (#1106) @DYH1319 +- Added `ElectronExecutableName` to separate the product name from the executable name (#1003) @AeonSake - Added build extensibility properties `ElectronSkipExecCommands` and `ElectronIntermediatePublishDir` (#1106) @DYH1319 # 0.5.2 diff --git a/docs/Using/Configuration.md b/docs/Using/Configuration.md index e37bf5c..17d1fdd 100644 --- a/docs/Using/Configuration.md +++ b/docs/Using/Configuration.md @@ -28,11 +28,35 @@ These are the current default values when you don't make any changes: $(MSBuildProjectName.Replace(".", "-").ToLower()) electron-builder.json $(MSBuildProjectName) + ../.. false ``` +### Product Name and Executable Name + +`Title` is the product name of the application. It is used for the window title, the installer, the macOS app bundle and the Linux desktop entry, and it may contain spaces and other characters that are awkward in a file name. + +`ElectronExecutableName` controls the name of the executable inside the package (electron-builder's `executableName`). When it is not set, it defaults to the following behavior: + +| Target | Default | +| --- | --- | +| Windows | `$(Title)` | +| Linux / macOS | `$(ElectronPackageId)` | + +So to ship a product called `My Great App` with a `mygreatapp` binary on every platform: + +```xml + + My Great App + mygreatapp + +``` + +> [!NOTE] +> `ElectronExecutable` is a separate, advanced setting: it is the binary Electron.NET launches when the .NET app starts first. It defaults to `ElectronExecutableName` and only needs to be changed when the package contains a launcher stub (for example added by an electron-builder hook) that should be started instead of the Electron binary. + ### Custom Packaging Layout `ElectronRootDir` tells the .NET app where to find the Electron binary when it is started first (DotNet-First startup of a packaged app). The path is resolved relative to the directory of the .NET executable; absolute paths are used as-is. @@ -86,11 +110,17 @@ Since electron builder still expects a `package.json` file to exist, ElectronNET "productName": "$(ElectronTitle)", "build": { "appId": "$(ElectronPackageId)", + "win": { + "executableName": "$(ElectronExecutableName)" + }, + "mac": { + "executableName": "$(ElectronExecutableName)" + }, "linux": { "desktop": { "entry": { "Name": "$(Title)" } }, - "executableName": "$(ElectronPackageId)" + "executableName": "$(ElectronExecutableName)" }, "deb": { "desktop": { diff --git a/src/ElectronNET/build/ElectronNET.Core.targets b/src/ElectronNET/build/ElectronNET.Core.targets index 753b130..f615ce3 100644 --- a/src/ElectronNET/build/ElectronNET.Core.targets +++ b/src/ElectronNET/build/ElectronNET.Core.targets @@ -1,10 +1,16 @@ - + win - $(Title) - $(ElectronPackageId) + $(Title) + $(ElectronPackageId) + + + + + $(ElectronExecutableName) diff --git a/src/ElectronNET/build/ElectronNET.LateImport.targets b/src/ElectronNET/build/ElectronNET.LateImport.targets index 5866c7b..1e405ec 100644 --- a/src/ElectronNET/build/ElectronNET.LateImport.targets +++ b/src/ElectronNET/build/ElectronNET.LateImport.targets @@ -633,6 +633,7 @@ For more information, see: https://github.com/ElectronNET/Electron.NET/wiki/Migr app\package.json instead. --> + diff --git a/src/ElectronNET/build/ElectronNETRules.Project.xaml b/src/ElectronNET/build/ElectronNETRules.Project.xaml index 4782916..bc55308 100644 --- a/src/ElectronNET/build/ElectronNETRules.Project.xaml +++ b/src/ElectronNET/build/ElectronNETRules.Project.xaml @@ -553,6 +553,12 @@ Category="General"> + + +