|
23 | 23 | the Reactor NuGet (see Reactor.csproj) and embedded into the mur CLI. |
24 | 24 | Invokes the apphost .exe (not `dotnet $(TargetPath).dll`) so the build |
25 | 25 | works on machines whose `dotnet` host arch differs from $(Platform). --> |
26 | | - <!-- Skip during publish/pack flows that set a RuntimeIdentifier. A propagated |
27 | | - RID may produce a cross-arch exe that the host can't execute (e.g. CI's |
28 | | - `dotnet publish` for win-arm64 running on a windows-x64 runner). The |
29 | | - committed skills/reactor.api.txt is still picked up by pack; regen |
30 | | - happens during the upstream slnx build where no RID is in play. --> |
| 26 | + <!-- Skip when the build target arch doesn't match the host arch — otherwise |
| 27 | + the apphost is foreign and exits with code 216 ("not compatible with the |
| 28 | + version of Windows you're running"). This happens in two CI paths: |
| 29 | + (a) `dotnet build Reactor.slnx` on windows-latest (x64 host) where the |
| 30 | + slnx default Platform is ARM64. |
| 31 | + (b) `dotnet publish` with a cross-arch RuntimeIdentifier (win-arm64 |
| 32 | + on the x64 runner). |
| 33 | + The committed skills/reactor.api.txt is still picked up by pack; regen |
| 34 | + only needs to fire on dev machines where $(Platform) matches the host. --> |
| 35 | + <PropertyGroup> |
| 36 | + <!-- $(NETCoreSdkRuntimeIdentifier) is set by the .NET SDK to the host RID |
| 37 | + (e.g. win-x64, win-arm64). Trim everything before the dash. --> |
| 38 | + <_ReactorApiHostArch Condition="$(NETCoreSdkRuntimeIdentifier.Contains('-'))">$(NETCoreSdkRuntimeIdentifier.Substring($([MSBuild]::Add($(NETCoreSdkRuntimeIdentifier.IndexOf('-')), 1))).ToLowerInvariant())</_ReactorApiHostArch> |
| 39 | + <_ReactorApiTargetArch Condition="'$(Platform)' == 'x64'">x64</_ReactorApiTargetArch> |
| 40 | + <_ReactorApiTargetArch Condition="'$(Platform)' == 'ARM64'">arm64</_ReactorApiTargetArch> |
| 41 | + <_ReactorApiTargetArch Condition="'$(_ReactorApiTargetArch)' == '' and '$(RuntimeIdentifier)' == 'win-x64'">x64</_ReactorApiTargetArch> |
| 42 | + <_ReactorApiTargetArch Condition="'$(_ReactorApiTargetArch)' == '' and '$(RuntimeIdentifier)' == 'win-arm64'">arm64</_ReactorApiTargetArch> |
| 43 | + <_ReactorApiTargetArch Condition="'$(_ReactorApiTargetArch)' == ''">$(_ReactorApiHostArch)</_ReactorApiTargetArch> |
| 44 | + </PropertyGroup> |
31 | 45 | <Target Name="EmitReactorApiTxt" |
32 | 46 | AfterTargets="Build" |
33 | | - Condition="'$(SkipReactorApiGen)' != 'true' and '$(RuntimeIdentifier)' == ''"> |
| 47 | + Condition="'$(SkipReactorApiGen)' != 'true' and '$(_ReactorApiTargetArch)' == '$(_ReactorApiHostArch)'"> |
34 | 48 | <Exec Command=""$(TargetDir)$(AssemblyName).exe" "$(MSBuildThisFileDirectory)..\.."" |
35 | 49 | ConsoleToMSBuild="true" |
36 | 50 | IgnoreExitCode="false" /> |
|
0 commit comments