Home > Back-end >  Embedding Webview2 dll within an exe file WPF
Embedding Webview2 dll within an exe file WPF

Time:03-03

I want to release my WPF app just in an .exe file. I have 3 dll's from the WebView2 nuget package.

Microsoft.Web.WebView2.Wpf.dll
Microsoft.Web.WebView2.Core.dll
Microsoft.Web.WebView2.WinForms.dll

As noted, Costura.Fody doesn't work for this, but I have a native runtime .dll and I saw this can help to release the app.

CodePudding user response:

What version of .NET are you targeting? This will be easiest if you're on .NET 5 (ideally 6).

This page documents how to publish a .NET application as a single file, with instructions for the dotnet CLI and Visual Studio. I believe you will need to follow the instructions under "Including native libraries" and set the IncludeNativeLibrariesForSelfExtract MSBuild property to true, as both WPF and the WebView2 bindings use a native DLL.

  • Related