Files
ExecuteR/Directory.Build.targets
Alphaeus Mote 5e6a29e8b1 build: embed the product icon in every executable under src/
Directory.Build.targets sets ApplicationIcon for each Exe/WinExe project
under src/ (not tests, not non-Windows RIDs, not a project with its own),
so a new Windows executable gets the icon with no project change. The
path lives once, as ExecuteRIconPath in Directory.Build.props, which both
MSIs now use for ARPPRODUCTICON too; the three per-project copies are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 13:53:42 -05:00

25 lines
1.3 KiB
XML

<Project>
<!--
Branding (README, Branding): every executable under src/ (OutputType Exe
or WinExe) embeds the product icon, assets/icons/app.ico, so a new Windows
exe project picks it up with no project change. Here, not in
Directory.Build.props, because OutputType is only known once the project
body has been read. The SDK copies the managed assembly's Win32 resources
(icon and version info) into the apphost, single-file and self-contained
publishes included. Tests (and their helper exes under tests/) are left
out; a project that sets its own ApplicationIcon keeps it; non-Windows RIDs
have no use for one. Conditional on the file because the backend image's
build context has no assets directory.
-->
<PropertyGroup Condition="'$(ApplicationIcon)' == ''
And ('$(OutputType)' == 'Exe' Or '$(OutputType)' == 'WinExe')
And '$(IsTestProject)' != 'true'
And $([MSBuild]::MakeRelative('$(MSBuildThisFileDirectory)', '$(MSBuildProjectDirectory)').Replace('\', '/').StartsWith('src/'))
And ('$(RuntimeIdentifier)' == '' Or $(RuntimeIdentifier.StartsWith('win')))
And Exists('$(ExecuteRIconPath)')">
<ApplicationIcon>$(ExecuteRIconPath)</ApplicationIcon>
</PropertyGroup>
</Project>