Distribute a WebView2 app as a single executable file
You may want to distribute your application with a single executable file, instead of a package of many files. To create a single executable file, or to reduce the size of your package, you should statically link the WebView2Loader files. The WebView2 SDK contains a header file,
WebView2Loader.dll, and the
WebView2Loader.dll is a small component that helps apps locate the WebView2 Runtime, or Microsoft Edge preview channels, on the device.
For an app that doesn't ship
WebView2Loader.dll, do the following:
.vcxprojproject file for your app in a text editor, such as Visual Studio Code.
.vcprojproject file might be a hidden file, meaning that the file isn't shown in Visual Studio. To find hidden files, use the command line.
Locate the section in the code where you include the WebView2 NuGet package target files. The location in the code is highlighted in the following figure:
Copy the following code and paste it where the
<PropertyGroup> <WebView2LoaderPreference>Static</WebView2LoaderPreference> </PropertyGroup>
The inserted code is shown below:
Compile and run your app.
Submit and view feedback for