Webview2 and Inno Setup

Hi,
I’m struggling to create the installer of the windows version of my JUCE app using Inno Setup (disclaimer I didn’t use windows for years before attempting to build my project for windows).

Here’s the symptom : the .exe file in the build folder correctly uses webview2 (even when moved anywhere on the system) but not when it’s installed using the Inno Setup installer.

In Projucer, here are the relevant options enabled :

  • JUCE_WEB_BROWSER
  • JUCE_USES_WIN_WEBVIEW2_WITH_STATIC_LINKING
  • JUCE_USES_WIN_WEBVIEW2

In the .iss script, I just copy the .exe file like this :

...

[Files]
Source: "<ommited>\Builds\VisualStudio2022\x64\Release\App\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion

...

Is there something I can do to fix / troubleshoot this ?

ok, I think I have a lead : the app creates a folder MyApp.exe.Webview2/ at initial startup next to it.
If I move the installed .exe to somewhere like my user’s Desktop, it works fine.
So I guess, it’s an issue with the permissions of the app in a system folder (like Program Files/MyApp/) : the app fails to create the folder and fallbacks to ie web browser.

How to fix that is still an open question…

Ok, so that was actually the issue : installing in a user-writable folder fixed it but an even a better fix was to move the created folder somewhere else.

In fact, I just had to follow this blog post instructions :

.withWinWebView2Options (WebBrowserComponent::Options::WinWebView2{}
    .withUserDataFolder (File::getSpecialLocation (File::SpecialLocationType::tempDirectory))