Currently, the ElectronIcon property expects a file path which is then copied with the Copy instruction as a MSBuild task. However, the issue here is that the new/modern macOS app icon format .icon is actually just a folder (similar to how apps are also just folders with the .app extension). This format allows dynamic icons, grouping certain layers within the icon, applying different effects, and have platform-specific switches. The Copy instruction can only copy files, not directories, which causes the build to fail. Electron-builder itself has full support for the modern app icon format (see documentation) which is also the preferred format.
- NuGet Version: 0.4.1
- Electron Version: 41.0.3
- Electron Builder Version: 26.8.1
- Framework: net10.0
- Target: osx-arm64 (specified via publish profile)
- IDE: Visual Studio Code 1.111.0
electron_builder.json (relevant section only):
{
"$schema": "https://raw.githubusercontent.com/electron-userland/electron-builder/refs/heads/master/packages/app-builder-lib/scheme.json",
"mac": {
"files": [ "**/*", "!mac*/*" ],
"target": [ "dir" ],
"icon": "icon.icon"
}
}
Project configuration (relevant section only):
<PropertyGroup Label="ElectronNetCommon">
<ElectronIcon>..\assets\icon.icon</ElectronIcon>
</PropertyGroup>
Current workaround:
Using the legacy format .icns and normal .png both work (but you lose all the possibilities of the modern format).
Currently, the
ElectronIconproperty expects a file path which is then copied with theCopyinstruction as aMSBuildtask. However, the issue here is that the new/modern macOS app icon format.iconis actually just a folder (similar to how apps are also just folders with the.appextension). This format allows dynamic icons, grouping certain layers within the icon, applying different effects, and have platform-specific switches. TheCopyinstruction can only copy files, not directories, which causes the build to fail. Electron-builder itself has full support for the modern app icon format (see documentation) which is also the preferred format.electron_builder.json(relevant section only):{ "$schema": "https://raw.githubusercontent.com/electron-userland/electron-builder/refs/heads/master/packages/app-builder-lib/scheme.json", "mac": { "files": [ "**/*", "!mac*/*" ], "target": [ "dir" ], "icon": "icon.icon" } }Project configuration (relevant section only):
Current workaround:
Using the legacy format
.icnsand normal.pngboth work (but you lose all the possibilities of the modern format).