build: repair net40 Tray build and test-host binding redirects

Environment drift since ~7/26 broke a pristine checkout: (1) the SDK's
AutoGenerateBindingRedirects made RAR drop RioJoy.Core.dll for the net40
Tray exe (Bcl facade 1.5.11.0 vs 2.6.8.0 mismatch) - disabled for net40
with a hand-authored app.net40.config carrying the 2.6.8.0 redirects,
which XP's CLR 4.0 does not unify on its own; (2) 25 serial-link tests
failed on System.Runtime.CompilerServices.Unsafe load - Channels 8.0's
net462 binary references Unsafe 6.0.0.0 without declaring the dependency;
pinned the package and added the redirect app.config the earlier good
builds had auto-generated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-30 08:59:51 -05:00
co-authored by Claude Fable 5
parent d904f739d0
commit 23dec8901b
4 changed files with 60 additions and 0 deletions
+10
View File
@@ -21,6 +21,16 @@
<PropertyGroup Condition="'$(TargetFramework)' == 'net40'">
<PlatformTarget>x86</PlatformTarget>
<!-- The SDK defaults AutoGenerateBindingRedirects=true for .NET Framework
exes, which makes RAR walk the dependency closure of the NuGet-resolved
Microsoft.Bcl.Async assemblies; those were compiled against Microsoft.Bcl
facades v1.5.11.0 while the graph ships v2.6.8.0, and RAR classifies the
missing 1.5.11.0 facades as unresolvable framework assemblies and drops
the references (MSB3268 → CS0234). Turning generation off skips that
walk; the redirects the XP runtime still needs are hand-authored in
app.net40.config instead. -->
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<AppConfig>app.net40.config</AppConfig>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- XP (net40) flavor only, selected via <AppConfig> in the csproj. The
Microsoft.Bcl.Async assemblies were compiled against the Microsoft.Bcl
facades v1.5.11.0, but the package graph ships v2.6.8.0; XP's CLR 4.0 has
no framework unification for these (4.5+ does), so without the redirects
the first TaskEx call throws FileLoadException. Build-time redirect
generation is off (see AutoGenerateBindingRedirects in the csproj), so the
redirects live here statically. The SDK adds the <startup> section. -->
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.8.0" newVersion="2.6.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.8.0" newVersion="2.6.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.8.0" newVersion="2.6.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -15,6 +15,12 @@
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
<!-- Channels 8.0's net462 binary references Unsafe 6.0.0.0 but doesn't
declare it, so the graph would otherwise resolve 4.5.3 (assembly
4.0.4.1) and the test host dies with FileLoadException. Pin the
assembly Channels was built against; app.config redirects the older
requests (System.Memory / Tasks.Extensions) up to it. -->
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="PolySharp" Version="1.14.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copied to RioJoy.Core.Tests.dll.config so the VSTest host binds the single
deployed System.Runtime.CompilerServices.Unsafe 6.0.0.0 (pinned in the
csproj — System.Threading.Channels 8.0's net462 binary requires it) for
the older versions System.Memory / System.Threading.Tasks.Extensions
request. Static rather than auto-generated so the suite doesn't depend on
RAR's redirect suggestions, which vary with the installed SDK/reference
assemblies. -->
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>