.netwpfwebview2self-containedsingle-file

Understanding %temp%\.net Folder


When developing a single file self-contained WPF application using .NET 8 that uses the WebView2 component, a folder is created under %temp%\.net while the application is running.

What is the purpose of this folder, when and how is it created, and is it possible or needed to clean up this folder when the application is closed?


Solution

  • The folder %temp%\.net is needed because we are using native libraries (in our case the WebView2 component) in a single file deployment.

    This folder is used to extract the native libraries from the single executable and load them into memory. More information on this can be found here: Single-file deployment | Native libraries.