mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-21 06:25:20 +00:00
Added support for MacOS modern app icon #1047
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
- Fixed bloated ASAR file (#1080) @epsnm
|
||||
- Improved selection of runtime identifier (#1081) @epsnm
|
||||
- Added more variants for `UseElectron` (#1076) @AeonSake
|
||||
- Added support for modern MacOS app icon (#1047)
|
||||
|
||||
# 0.5.1
|
||||
|
||||
|
||||
@@ -70,6 +70,12 @@ Since electron builder still expects a `package.json` file to exist, ElectronNET
|
||||
}
|
||||
```
|
||||
|
||||
### App Icon Path
|
||||
|
||||
The `ElectronIcon` property supports classic icon files (such as `.ico` and `.icns`) and modern macOS `.icon` app icon packages.
|
||||
|
||||
For `.icon`, provide the folder path (for example `Assets/MyApp.icon`). During build/publish, Electron.NET copies the full directory into the Electron output so `electron-builder.json` can reference it (for example `"mac": { "icon": "MyApp.icon" }`).
|
||||
|
||||
### Node.js Integration
|
||||
|
||||
Electron.NET requires Node.js integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node.js integration like so:
|
||||
|
||||
@@ -313,7 +313,10 @@
|
||||
<ItemGroup>
|
||||
<!--<_ElectronFiles Include="$(ElectronIntermediatePackageJson)" />-->
|
||||
<_ElectronFiles Include="$(ElectronSplashScreen)" Condition="'$(ElectronSplashScreen)'!=''" />
|
||||
<_ElectronFiles Include="$(ElectronIcon)" Condition="'$(ElectronIcon)'!=''" />
|
||||
<_ElectronIconDirectories Include="$(ElectronIcon)"
|
||||
Condition="'$(ElectronIcon)'!='' AND Exists('$(ElectronIcon)') AND $([System.IO.Directory]::Exists('$(ElectronIcon)') )" />
|
||||
<_ElectronFiles Include="$(ElectronIcon)"
|
||||
Condition="'$(ElectronIcon)'!='' AND ( !Exists('$(ElectronIcon)') OR !$([System.IO.Directory]::Exists('$(ElectronIcon)') ) )" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -328,12 +331,25 @@
|
||||
<_ElectronFilesToCopy Include="@(_ElectronFiles->'%(FullPath)')" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ElectronIconDirectoryFiles Include="@(_ElectronIconDirectories->'%(FullPath)\**\*')" />
|
||||
<_ElectronIconDirectoryFiles Remove="@(_ElectronIconDirectoryFiles)" Condition="$([System.IO.Directory]::Exists('%(Identity)'))" />
|
||||
<_ElectronIconDirectoryFiles Update="@(_ElectronIconDirectoryFiles)">
|
||||
<ElectronIconRelativePath>$([System.String]::Copy('%(Identity)').Replace('$([MSBuild]::EnsureTrailingSlash(%(_ElectronIconDirectories.FullPath)))', ''))</ElectronIconRelativePath>
|
||||
</_ElectronIconDirectoryFiles>
|
||||
</ItemGroup>
|
||||
|
||||
<Message Importance="High" Text="_ElectronFilesToCopy: @(_ElectronFilesToCopy)" />
|
||||
<Message Importance="High" Text="_ElectronIconDirectoryFiles: @(_ElectronIconDirectoryFiles)" />
|
||||
|
||||
<ItemGroup>
|
||||
<_ElectronFilesToCopyWithTargetPath Include="@(_ElectronFilesToCopy)">
|
||||
<TargetPath>$(ElectronDirName)\%(FileName)%(Extension)</TargetPath>
|
||||
</_ElectronFilesToCopyWithTargetPath>
|
||||
|
||||
<_ElectronFilesToCopyWithTargetPath Include="@(_ElectronIconDirectoryFiles)">
|
||||
<TargetPath>$(ElectronDirName)\$(ElectronIconFileName)\%(ElectronIconRelativePath)</TargetPath>
|
||||
</_ElectronFilesToCopyWithTargetPath>
|
||||
</ItemGroup>
|
||||
|
||||
<Message Text="_ElectronFilesToCopyWithTargetPath: @(_ElectronFilesToCopyWithTargetPath)" />
|
||||
|
||||
@@ -572,7 +572,7 @@
|
||||
|
||||
<StringProperty Name="ElectronIcon"
|
||||
DisplayName="App Icon"
|
||||
Description="Choose a ICO file to be used as application icon"
|
||||
Description="Choose an icon path for the app (e.g. .ico, .icns, or modern macOS .icon folder)"
|
||||
Subtype="File"
|
||||
Category="General">
|
||||
<StringProperty.DataSource>
|
||||
@@ -581,7 +581,7 @@
|
||||
<StringProperty.ValueEditors>
|
||||
<ValueEditor EditorType="FilePath">
|
||||
<ValueEditor.Metadata>
|
||||
<NameValuePair Name="FileTypeFilter" Value="Icon files (*.ico)|*.ico|All files (*.*)|*.*" />
|
||||
<NameValuePair Name="FileTypeFilter" Value="Icon files (*.ico,*.icns)|*.ico;*.icns|All files (*.*)|*.*" />
|
||||
</ValueEditor.Metadata>
|
||||
</ValueEditor>
|
||||
</StringProperty.ValueEditors>
|
||||
|
||||
Reference in New Issue
Block a user