Merged PR 16988: Fix AnyCPU compilation

Previously the projection project was converted over to not use AnyCPU anymore. This was because there's a bug where the WindowsAppSdk bootstrap dll tries to deploy an AnyCPU version (which doesn't exist) and fails.

Not using AnyCPU causes issues down the line with adding more tests, so this change restores back to using AnyCPU. But it also addresses the bootstrap dll bug more directly, and works around it to deploy x86.
This commit is contained in:
Ian Blaauw 2021-09-08 14:44:56 +00:00 коммит произвёл Geoffrey Trousdale
Родитель 5047f60851
Коммит 4d5f43ec1c
5 изменённых файлов: 25 добавлений и 9 удалений

Просмотреть файл

@ -42,11 +42,7 @@
<ItemGroup> <ItemGroup>
<UAPProject Include="winrt\lib\winrt.lib.uap.vcxproj" /> <UAPProject Include="winrt\lib\winrt.lib.uap.vcxproj" />
<UAPProject Include="winrt\dll\winrt.dll.uap.vcxproj" /> <UAPProject Include="winrt\dll\winrt.dll.uap.vcxproj" />
<!-- Reunion currently has issues with AnyCpu projects, so as a hack we build the projection project for all the normal platforms --> <AnyCPUProject Include="winrt\projection.net5\winrt.projection.net5.csproj" />
<!-- <AnyCPUProject Include="winrt\projection.net5\winrt.projection.net5.csproj" /> -->
<UAPProject Include="winrt\projection.net5\winrt.projection.net5.csproj">
<BinDir>Windows</BinDir>
</UAPProject>
</ItemGroup> </ItemGroup>
<!-- Test projects --> <!-- Test projects -->

Просмотреть файл

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- The bootstrap dll doesn't exist for AnyCPU, which is an issue with WindowsAppSdk v1.0.
Temporary hack that forces it to copy over the x86 version (which is what AnyCPU defaults to for native binaries) -->
<Target Name="FixupBinPlaceBootstrapDll" Condition="'$(Platform)' == 'AnyCPU'" BeforeTargets="BinPlaceBootstrapDll">
<PropertyGroup>
<_TempWindowsAppSdkPlatform>$(_WindowsAppSDKFoundationPlatform)</_TempWindowsAppSdkPlatform>
<_WindowsAppSDKFoundationPlatform>x86</_WindowsAppSDKFoundationPlatform>
</PropertyGroup>
<Message Importance="High" Text="Temporarily setting WindowsAppSdk platform: $(_WindowsAppSDKFoundationPlatform)" />
</Target>
<Target Name="RestoreBinPlaceBootstrapDll" Condition="'$(Platform)' == 'AnyCPU'" AfterTargets="BinPlaceBootstrapDll">
<PropertyGroup>
<_WindowsAppSDKFoundationPlatform>$(_TempWindowsAppSdkPlatform)</_WindowsAppSDKFoundationPlatform>
</PropertyGroup>
<Message Importance="High" Text="Restoring WindowsAppSdk platform: $(_WindowsAppSDKFoundationPlatform)" />
</Target>
</Project>

Просмотреть файл

@ -36,7 +36,7 @@
<file target="lib\netcoreapp3.0\Microsoft.Graphics.Canvas.winmd" src="bin\UAPx86\release\winrt.dll.UAP\Microsoft.Graphics.Canvas.winmd" /> <file target="lib\netcoreapp3.0\Microsoft.Graphics.Canvas.winmd" src="bin\UAPx86\release\winrt.dll.UAP\Microsoft.Graphics.Canvas.winmd" />
<file target="lib\net45\Microsoft.Graphics.Canvas.winmd" src="bin\UAPx86\release\winrt.dll.UAP\Microsoft.Graphics.Canvas.winmd" /> <file target="lib\net45\Microsoft.Graphics.Canvas.winmd" src="bin\UAPx86\release\winrt.dll.UAP\Microsoft.Graphics.Canvas.winmd" />
<file target="lib\net5.0-windows10.0.18362.0\Microsoft.Graphics.Canvas.Interop.dll" src="bin\x86\release\winrt.projection.net5\Microsoft.Graphics.Canvas.Interop.dll" /> <file target="lib\net5.0-windows10.0.18362.0\Microsoft.Graphics.Canvas.Interop.dll" src="bin\anycpu\release\winrt.projection.net5\Microsoft.Graphics.Canvas.Interop.dll" />
<!-- TODO: Doc generation is failing to load Microsoft.System.DispatcherQueue --> <!-- TODO: Doc generation is failing to load Microsoft.System.DispatcherQueue -->
<!-- <!--

Просмотреть файл

@ -61,7 +61,7 @@ $env:Platform = "AnyCPU"
$env:Configuration = "Release" $env:Configuration = "Release"
Write-Verbose "Restoring Release, AnyCPU" Write-Verbose "Restoring Release, AnyCPU"
& $nugetExe restore $slnPath & $nugetExe restore $slnPath
$env:Config = "Debug" $env:Configuration = "Debug"
Write-Verbose "Restoring Debug, AnyCPU" Write-Verbose "Restoring Debug, AnyCPU"
& $nugetExe restore $slnPath & $nugetExe restore $slnPath

Просмотреть файл

@ -17,8 +17,7 @@
<CSWinRTWindowsMetadata>local</CSWinRTWindowsMetadata> <CSWinRTWindowsMetadata>local</CSWinRTWindowsMetadata>
<CsWinRTGenerateProjection>true</CsWinRTGenerateProjection> <CsWinRTGenerateProjection>true</CsWinRTGenerateProjection>
<!-- This should be AnyCPU, but WindowsAppSdk 1.0 has issues with it that should be fixed in the future --> <Platforms>AnyCPU</Platforms>
<Platforms>x86;x64;arm64</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -39,4 +38,7 @@
<RuntimeFrameworkVersion>10.0.18362.18</RuntimeFrameworkVersion> <RuntimeFrameworkVersion>10.0.18362.18</RuntimeFrameworkVersion>
</FrameworkReference> </FrameworkReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildThisFileDirectory)..\..\build\WindowsAppSdk.BootstrapFix.targets" />
</Project> </Project>