MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Bug]: Cannot exclude bloat from Microsoft.Web.WebView2 package

Open
#4,860 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

Referencing Microsoft.Web.WebView2 produces significant bloat in the output folder. The same goes for deployed app. All in all, 1 MB which can be throw away. But how?

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

1.0.2792.45

SDK Version

No response

Framework

WPF

Operating System

Windows 10

OS Version

No response

Repro steps
  1. Create a WPF project targeting .NET 8.
  2. Add a reference to WebView2 as shown below.
  3. Optionally add an x64 configuration and select it.
<ItemGroup>
  <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2792.45" />
</ItemGroup>

Now look in the build folder. Why do we see all this bloat? Targeting WPF and x64 we certainly don't need all this:

  • Microsoft.Web.WebView2.Core.xml
  • Microsoft.Web.WebView2.WinForms.dll
  • Microsoft.Web.WebView2.WinForms.xml
  • Microsoft.Web.WebView2.Wpf.xml
  • runtimes/win-arm64/native/WebView2Loader.dll
  • OK: runtimes/win-x64/native/WebView2Loader.dll
  • runtimes/win-x86/native/WebView2Loader.dll
Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WPF .NET 8 project and its Microsoft.Web.WebView2 PackageReference in the shown .csproj snippet, then inspect the build folder contents. Determine why the listed WinForms, XML, and runtime files are copied for the x64 WPF configuration. Done means the unnecessary files are excluded while the required win-x64 WebView2Loader.dll remains.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.