src/controls/dev/WebView2/WebView2-update.md
When Edge releases a new WebView2 SDK, we may want to update the version that Xaml WebView2 uses. As part of the product, we ship a WebView2 SDK. For test code only, we include WebView2 Runtime installers, in case the pipeline VMs don't already have a runtime installed. This document will help you update these two components.
[[TOC]]
Edge WebView2 team's doc on SDK & browser versioning, compat scenarios, release process/schedule, etc:
Link to PowerPoint doc
Edge release schedule for the rest of 2021:
Edge_release_schedule.png
The public Edge WebView2 nuget packages can be found here: https://www.nuget.org/packages/Microsoft.Web.WebView2/
In the past, Xaml had to consume prerelease packages or create their own modified SDK packages, because the release versions did not contain the WinRT bits. However, this limitation no longer exists and official release versions should be used when possible. When we must use a private SDK version, TODO
When Xaml WebView2 tests run, they check to see if a WebView2 runtime is available on the machine to use. If not, the tests install one. These installers live in a nuget package we create and keep in the Microsoft.UI.DCPP.Dependencies.Edge feed.
This package is only used for tests. The WinUI product does not specify or require a specific Runtime version (instead, apps may specify a minimum version depending on the APIs they use).
Versions are defined in %<edgeroot>%\edge_embedded_browser\client\win\embedded_browser_version_info_values.h.version:
#ifndef EDGE_EMBEDDED_BROWSER_CLIENT_WIN_EMBEDDED_BROWSER_VERSION_INFO_VALUES_H_
#define EDGE_EMBEDDED_BROWSER_CLIENT_WIN_EMBEDDED_BROWSER_VERSION_INFO_VALUES_H_
#define PRODUCT_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
#define MAJOR_NUMBER @MAJOR@
#define MINOR_NUMBER @MINOR@
#define BUILD_NUMBER @BUILD@
#define PATCH_NUMBER @PATCH@
#endif // EDGE_EMBEDDED_BROWSER_CLIENT_WIN_EMBEDDED_BROWSER_VERSION_INFO_VALUES_H_
The version of Edge we install for tests should have a build number greater than or equal to the number of the SDK. For example, Edge version 82.0.436.0 can work with SDK version 0.9.430.
The SDK includes the WinRT API wrapper and the loader dll, and those get pushed into the consuming NuGet package (i.e. WinUI3 app).
The implementation code (Win32/COM) is in embeddedbrowserwebview.dll, which ships with the browser. In order for
implementations to be found (QIs to succeed), the 3-digit build # on the browser version must be >= 3-digit build # of
SDK version.
However, they also have a policy of maintaining some older 'snapshots' of the implementation (the deprecated folders)
for a limited amount of time. That way, older apps can still work with newer browsers in the general case. (For
example, if an API was previously experimental before but is currently final, older app's QIs to
ICWV2Experimental->Foo() won't fail while the deprecated path is maintained.)
UpdateWebView2.cmdinit and make sure everything looks goodFirst, decide what SDK and Runtime versions you're going to update to. See above for how these versions work together. This may also necessitate working with the Edge WebView2 team to understand what SDK will have any new APIs we need.
Run UpdateWebView2.cmd. This can be found in the \scripts folder. For help, run UpdateWebView2.cmd /?.
This script will:
\eng\versions.props and \controls\dev\dll\packages.config
Updating these numbers is actually the only thing that needs to happen to consume a new, public SDK. All other instructions in this document (besides step 4 used for private SDKs) are related to the runtime we include for tests.
\packages.config
\dxaml\test\infra\taefhostappmanaged\TaefHostAppManaged.csproj
\dxaml\external\Microsoft.UI.DCPP.Dependencies.Edge.nuspec
mini_installers you will drop into the repo, to be packaged into a nuget package<repo_root>\dxaml\test\edge\88.0.676.0\x64\mini_installer.exe<repo_root>\dxaml\test\edge\88.0.676.0\x86\mini_installer.exeDrop the Edge installers into the directories created in the previous step
Pack and push the Runtime installer nuget package
nuget pack <.nuspec path> -OutputDirectory <repo_root>\packages>nuget pack <repo_root>\dxaml\external\Microsoft.UI.DCPP.Dependencies.Edge.nuspec -OutputDirectory <repo_root>\packages\Microsoft.UI.DCPP.Dependencies.Edge
Attempting to build package from 'Microsoft.UI.DCPP.Dependencies.Edge.nuspec'.
Successfully created package 'C:\Users\dkomin\source\repos\microsoft-ui-xaml-lift-full\packages\Microsoft.UI.DCPP.Dependencies.Edge\Microsoft.UI.DCPP.Dependencies.Edge.80.0.333.nupkg'.
WARNING: NU5048: The 'PackageIconUrl'/'iconUrl' element is deprecated. Consider using the 'PackageIcon'/'icon' element instead. Learn more at https://aka.ms/deprecateIconUrl
nuget push <.nupkg path> -Source WinUI.Dependencies -apikey <ask_a_teammate_for_key>> nuget push <repo_root>\packages\Microsoft.UI.DCPP.Dependencies.Edge\<created_nupkg> -Source WinUI.Dependencies -apikey <ask_a_teammate_for_key>
MSBuild auto-detection: using msbuild version '16.3.2.50909' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin'.
[CredentialProvider]VstsCredentialProvider - Acquired bearer token using 'ADAL Windows Integrated Authentication'
[CredentialProvider]VstsCredentialProvider - Attempting to exchange the bearer token for an Azure DevOps session token.
Pushing Microsoft.UI.DCPP.Dependencies.Edge.80.0.333.nupkg to 'https://microsoft.pkgs.visualstudio.com/_packaging/1103ce32-f206-4cab-b967-dcc556dacd13/nuget/v2/'...
PUT https://microsoft.pkgs.visualstudio.com/_packaging/1103ce32-f206-4cab-b967-dcc556dacd13/nuget/v2/
Accepted https://microsoft.pkgs.visualstudio.com/_packaging/1103ce32-f206-4cab-b967-dcc556dacd13/nuget/v2/ 16326ms
Your package was pushed.
Follow this step ONLY if you are updating the SDK to a private version
If you are updating to a private SDK version (one not on nuget.org) you must also push it to the WinUI.Dependencies
private feed. Download the signed nuget from the Edge WebView2 pipeline, and push it to the feed like you did above.
Run init to ensure the package gets pulled down correctly.
init should run without errorspackages directory in your repo, you should now see a packages/Microsoft.UI.DCPP.Dependencies.Edge
directory containing the version you just created, and a packages/Microsoft.UI.DCPP.Dependencies.Edge.<version>
directory below it (e.g. packages/Microsoft.UI.DCPP.Dependencies.Edge.80.0.333)