Statically link the WebView2 loader library
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 non-stable channels of Microsoft Edge, on the device.
For apps that don't want to ship a
WebView2Loader.dll, complete the following steps.
.vcxprojproject file for your app in a text editor, such as Visual Studio Code.
.vcprojproject file may be a hidden file, meaning it does not display in Visual Studio. Use the command-line to find hidden files.
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 snippet and paste it where the
<PropertyGroup> <WebView2LoaderPreference>Static</WebView2LoaderPreference> </PropertyGroup>
Edit the additional dependencies of the build configuration for your app. To begin, find all of the
<AdditionalDependencies>tags. For each, add
version.libas an additional dependency to every different build configuration in the
The WebView2 team aims to automate adding the additional dependency in future releases.
Compile and run your app.
Getting in touch with the WebView2 team
Share your feedback to help build richer WebView2 experiences. To submit feature requests or bugs, or search for known issues, navigate to the Microsoft Edge WebView feedback repo.
- To get started using WebView2, navigate to WebView2 Get Started Guides.
- For a comprehensive example of WebView2 capabilities, navigate to WebView2Samples on GitHub.
- For more detailed information about WebView2 APIs, navigate to API reference.
- For more information about WebView2, navigate to WebView2 Resources.