|
1 | | -# Introduction |
2 | | -This sample shows off using a WebView2 control in a WinUi 3 Windows SDK Packaged application. |
3 | | - |
4 | | -It also optionaly shows how you would update the application to ship with a fixed WebView2 version instead of using the version installed and running on the Windows computer. |
5 | | - |
6 | | -# Relevant directories |
7 | | - |
8 | | -| Directory | Contents | |
9 | | ---- | --- | |
10 | | -| WebView2_WinUI3_Sample | Project code | |
11 | | -| WebView2_WinUI3_Sample (Package) | Packaging and distribution project | |
12 | | -| WebView2_WinUI3_Sample (Package)\FixedRuntime | (Optional) Fixed WebView2 runtime | |
13 | | -| WebView2_WinUI3_Sample (Package)\FixedRuntime\95.0.1020.53 | (Optional) Fixed WebView2 runtime sample | |
14 | | - |
15 | | - |
16 | | -# Fixed version usage |
17 | | -If you want to ship a fixed version of the WebView2 runtime with your application you will need to include it in your project. |
18 | | - |
19 | | -Instructions can be found at: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution |
20 | | - |
21 | | -The following assume you are using runtime version 95.0.1020.53, you will change this number to whatever version you are using. |
22 | | - |
23 | | -You will need to: |
24 | | -1 Include the fixed WebView2 runtime in the package project |
25 | | -<pre>\WebView2_WinUI3_Sample\WebView2_WinUI3_Sample (Package)\FixedRuntime\95.0.1020.53\</pre> |
26 | | -2 Update the package project wapproj file for the version your using |
27 | | -<pre> < Content Include="FixedRuntime\95.0.1020.53\\**\*.*" > </pre> |
28 | | -3 Uncomment the code in app.xaml.cs to enable the runtime override |
29 | | -<pre> |
30 | | -public App() |
31 | | -{ |
32 | | - this.InitializeComponent(); |
33 | | - // If you are shipping a fixed version WebView2 SDK with your application you will need |
34 | | - // to use the following code (update the runtime version to what you are shipping. |
35 | | - StorageFolder localFolder = Windows.ApplicationModel.Package.Current.InstalledLocation; |
36 | | - String fixedPath = Path.Combine(localFolder.Path, "FixedRuntime\\95.0.1020.53"); |
37 | | - Debug.WriteLine($"Launch path [{localFolder.Path}]"); |
38 | | - Debug.WriteLine($"FixedRuntime path [{fixedPath}]"); |
39 | | - Environment.SetEnvironmentVariable("WEBVIEW2_BROWSER_EXECUTABLE_FOLDER", fixedPath); |
40 | | -} |
41 | | -</pre> |
42 | | -4 Update the version information for the appropriate version |
43 | | -<pre> |
44 | | -String fixedPath = Path.Combine(localFolder.Path, "FixedRuntime\\95.0.1020.53"); |
45 | | -</pre> |
46 | | - |
| 1 | +# WinUI 3 (Windows App SDK) sample app |
47 | 2 |
|
| 3 | +This sample (**WebView2_WinUI3_Sample**) demonstrates using a WebView2 control in a WinUI 3 (Windows App SDK) Packaged application. |
48 | 4 |
|
| 5 | + |
49 | 6 |
|
| 7 | +This sample also allows you to ship the app with a fixed-version WebView2 Runtime, instead of using whichever version of the WebView2 Runtime is installed and running on the user's computer. |
50 | 8 |
|
| 9 | +To use this sample, see [WinUI 3 (Windows App SDK) sample app](https://learn.microsoft.com/microsoft-edge/webview2/samples/webview2-winui3-sample). |
0 commit comments