Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong WebView2Loader.dll and Microsoft.Web.WebView2.Core.dll when create ARM64 package on x64 machine #4826

Open
sunjw opened this issue Oct 24, 2024 · 2 comments

Comments

@sunjw
Copy link

sunjw commented Oct 24, 2024

Describe the bug

After created store upload package in VS 2022, with selecting x64 and arm64 architecture, on a x64 machine, the "WebView2Loader.dll" in the ARM64 msix is a x64 version, not aarch64.

Steps to reproduce the bug

  1. Create store upload package
  2. Selecting x64 and arm64 architecture

Expected behavior

No response

Screenshots

Image
Image

NuGet package version

None

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

@sunjw sunjw changed the title Wrong WebView2Loader.dll when create ARM64 package on x64 machine Wrong WebView2Loader.dll and Microsoft.Web.WebView2.Core.dll when create ARM64 package on x64 machine Oct 24, 2024
@DHowett
Copy link
Member

DHowett commented Nov 1, 2024

This is impacting PowerToys as well - our ARM64 deployment is on the floor.

@Scottj1s
Copy link
Member

Scottj1s commented Nov 1, 2024

A fix for this issue is expected in the November update of Microsoft.Web.WebView2 package on nuget.org. In the meantime, the following workaround may be useful (added to your project file):

<Target Name="FixWebView2Path" BeforeTargets="PrepareForBuild" Condition="'$(PlatformTarget)'=='arm64'">
  <ItemGroup>
    <Content Remove="@(Content)" Condition="'%(Content.Link)'=='runtimes\win-x64\native\WebView2Loader.dll'"/>
    <Content Include="$(NugetRoot)runtimes\win-arm64\native\WebView2Loader.dll">
      <Link>runtimes\win-arm64\native\WebView2Loader.dll</Link>
      <PublishState>Included</PublishState>
      <Visible>False</Visible>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <IncludeInVsix>true</IncludeInVsix>
      <Pack>false</Pack>
    </Content>
    <ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(FileName)%(Extension)'=='Microsoft.Web.WebView2.Core.dll'"/>
    <ReferenceCopyLocalPaths Include="$(NugetRoot)runtimes\win-arm64\native_uap\Microsoft.Web.WebView2.Core.dll"/>
  </ItemGroup>
</Target>

DHowett pushed a commit to microsoft/PowerToys that referenced this issue Nov 1, 2024
After we upgraded Windows App SDK to 1.6, Dev Files Preview on Peek has been broken on ARM64.
For .86, we've added WebView2 to Registry Preview in order to have Monaco Editor as the text editor, which is also broken on ARM64.
After a lengthy investigation, it seems we've found the core issue, PowerToys has been shipping with a x64 Microsoft.Web.WebView2.Core.dll in the ARM64 installer, which fails at runtime.
We seem to have hit a version of microsoft/WindowsAppSDK#4826

When we build PowerToys in Dart for release, we publish some of the C# WinUI3Apps after building PowerToys and before signing / building the install. This means that the WindowsAppSDK build will recopy its WebView2 dependency, which for some reason is ARM64. On local builds of PowerToys, PowerRename, a C++ WinAppSDK application finished last, which copies the right dll and it's the reason we weren't being able to repro the issue on local builds of ARM64 PowerToys.

This PR solves the issue by including a short time hack in the CI to copy the right dll after publishing the C# WinUI3Apps when building for ARM64.

## Validation Steps Performed
Waiting for 4 concurrent builds of ARM64 from Dart to test whether the problem is solved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants