Repository navigation
Description
Current behavior
The Uno.Sdk still adds a PackageReference to Microsoft.Web.WebView2 (with Aliases=mswebview2) to every desktop head that uses the webview feature, even though the Microsoft.Web.WebView2-based backend was removed in #23757 (chore: remove Microsoft.Web.WebView2 backend). The Win32 runtime now only uses the AOT backend (WebView2Aot).
The reference, and the two MSBuild workaround targets that exist only to make it work, are still in the SDK:
Uno.Implicit.Packages.ProjectSystem.Desktop.targetsL19-L26 (UnoWebView2Aliasesand theMicrosoft.Web.WebView2package reference)Uno.SingleProject.Desktop.targetsL65-L102 (_UnoWebView2RemoveWpfand_UnoWebView2Workaround)packages.jsonL376-L379 andMicrosoftWebView2VersioninImplicitPackagesResolver(the version group)
As a result, every desktop head with the webview feature restores the package and copies its managed assemblies and native loaders into the output, although no Uno 7.0 runtime assembly uses them.
Expected behavior
A desktop head that uses the webview feature should not restore or ship Microsoft.Web.WebView2 once nothing uses it. The package reference, the UnoWebView2Aliases / UnoDisableWebView2Workarounds properties, the two workaround targets, and the MicrosoftWebView2 entry in packages.json can be removed.
How to reproduce it
-
Create a folder with these files.
global.json:{ "msbuild-sdks": { "Uno.Sdk": "7.0.0-dev.67" }, "sdk": { "allowPrerelease": true } }App.csproj:<Project Sdk="Uno.Sdk"> <PropertyGroup> <TargetFramework>net10.0-desktop</TargetFramework> <OutputType>Exe</OutputType> <UnoSingleProject>true</UnoSingleProject> <UnoFeatures>Hosting;webview</UnoFeatures> </PropertyGroup> <ItemGroup> <!-- Only needed to get past an unrelated duplicate-type error with the current dev packages --> <PackageReference Include="Uno.WinUI.Lottie" Version="7.0.0-dev.701" ExcludeAssets="all" /> </ItemGroup> </Project>
Program.cs:public static class Program { public static void Main() { } }
(The
nuget.configpoints at nuget.org plus the Uno dev feed.) -
Run
dotnet publish -c Release -o out. -
List the output folder.
Result (runtime-verified, nothing is executed, this is a build and publish check):
out\Microsoft.Web.WebView2.Core.dll 698,208 bytes
out\Microsoft.Web.WebView2.Core.xml 612,031 bytes
out\Microsoft.Web.WebView2.WinForms.dll 39,264 bytes
out\Microsoft.Web.WebView2.WinForms.xml 41,869 bytes
out\runtimes\win-x64\native\WebView2Loader.dll 194,912 bytes
out\runtimes\win-x86\native\WebView2Loader.dll 155,488 bytes
out\runtimes\win-arm64\native\WebView2Loader.dll 180,064 bytes
project.assets.json also shows Microsoft.Web.WebView2/1.0.4258.31 being restored. That is roughly 1.3 MB of binaries plus about 650 KB of XML docs in every published webview desktop app. I scanned the assembly references of the published output: no Uno assembly references Microsoft.Web.WebView2.Core (only the app's own App.dll and Microsoft.Web.WebView2.WinForms.dll do). I did not check why App.dll carries the reference; it may be a side effect of the package reference itself.
Workaround
Nothing needed to keep apps working, the extra files are just dead weight. UnoDisableWebView2Workarounds=true only skips the Microsoft.Web.WebView2.Wpf reference removal and the aliasing, it does not stop the package being restored and copied.
Works on UWP/WinUI
N/A (Uno.Sdk packaging issue)
Environment
Other
NuGet package version(s)
Uno.Sdk 7.0.0-dev.67 (newest published 7.0 dev at the time of testing). Source references above are on master at e98c0dcdc36.
Affected platforms
Skia Desktop (Windows, Linux, macOS) with the webview feature
IDE
dotnet CLI
IDE version
.NET SDK 10.0.401
Relevant plugins
No response
Anything else we need to know?
Confirmed by a real publish (above) and by source inspection of the SDK targets on master. Whether any consumer still relies on the mswebview2 alias outside this repo is not something I checked. Within this repo, the only remaining PackageReference to the package is in SamplesApp.csproj and the sync-generator references project.
Activity
Xiaoy312 commentedon Nov 3, 2026
Update after investigating this: the managed part of
Microsoft.Web.WebView2is unused, but the package itself is still needed.What is needed. The
WebView2Aotbackend loads the nativeWebView2Loader.dll(Win32WebView2Loader.EnsureinUno.UI.Runtime.Win32). TheWebView2Aotpackage doesn't ship that file; its README says to take it fromMicrosoft.Web.WebView2. Removing the package reference entirely publishes an app without the loader. On a machine without a strayWebView2Loader.dllonPATH, the Windows WebView then fails at runtime withDllNotFoundException. The build still succeeds. This is easy to miss on a dev box: the Windows Performance Toolkit, for example, puts aWebView2Loader.dllonPATH.What is dead weight.
Microsoft.Web.WebView2.Core.dll,Microsoft.Web.WebView2.WinForms.dll, their XML docs (about 1.4 MB), and the compile reference that the implicitmswebview2alias exists for. Today these cost only size: apps build and run normally.The workaround targets are still needed. The package adds its managed references by hand, so a normal
Aliasessetting never reachesMicrosoft.Web.WebView2.Core. Without_UnoWebView2Workaround, a project that referencesMicrosoft.Web.WebView2itself and uses Uno'sMicrosoft.Web.WebView2.Coretypes fails to build with CS0433. SamplesApp is one such project.Revised expected behavior: a desktop head with the
webviewfeature still restoresMicrosoft.Web.WebView2, but ships onlyruntimes/win-*/native/WebView2Loader.dll.#25996 does that: the implicit reference becomes
IncludeAssets="native"andUnoWebView2Aliasesis removed, while the workaround targets andMicrosoftWebView2Versionare kept. It was checked with the repro from this issue:WebView2Loader.dllshippedPATH)Uno.Sdk7.0.0-dev.67 (published)Uno.Sdk7.0.0-dev.130 (published)On the open question in the report: the app's own
App.dllreferencesMicrosoft.Web.WebView2.Coreonly because of the implicit package reference. With #25996 it no longer does.This is a breaking change for apps that used the package's managed API through the implicit
mswebview2alias. They need an explicit<PackageReference Include="Microsoft.Web.WebView2" Aliases="mswebview2" />, as described in the migration guide entry added by #25996.fix(sdk)!: Ship only the WebView2 native loader