InnoSetup - need help when using WebView2 in desktop Windows

Hi. I’ve been at this all day. Because of some changes YouTube made with embedded videos, I’ve been working on a solution. I decided to go with Vimeo as the video host. On Mac, it’s an easy swap. On Windows, I need to use WebView2.

I think everything is set up properly as the videos play just fine on Windows during debug and also after I build the app and run the app from the build folder on Windows. However, the videos will not play once I create the installer via InnoSetup. Does anyone know if there is a certain command line that is necessary to add to Inno? I thought maybe the WebView2 bootstrapper file might not be getting installed, so I included that as well.

I would really appreciate any help on this as my “videos not playing with YouTube embedded in the desktop apps” is really escalating with my users

I can post my InnoSetup code if that would help narrow down the search. Please help!

Just putting a bump on this post as I’m still struggling with the WebView2 (Vimeo video player) not showing in Windows after the installer is made

You haven’t said what version of Xojo or what version of windows you are targeting.

Are you putting the WebView2RuntimeInstaller in InnoSetup to be installed ? This is what I use to install WebView2 and be sure its installed.

And the version is downloaded there: Microsoft Edge WebView2 | Microsoft Edge Developer

After clicking download, I took the Evergreen Standalone Installer

[Files]
Source: "Files\VC_redist.x64.exe"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
Source: "Files\MicrosoftEdgeWebView2RuntimeInstallerX64.exe"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
 
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
#ifdef x64
Filename: "{tmp}\VC_redist.x64.exe"; Parameters: "/install /quiet /norestart"; StatusMsg: "Installing 64-bit runtime..."; Check: Is64BitInstallMode; Flags: waituntilterminated
Filename: "{tmp}\MicrosoftEdgeWebView2RuntimeInstallerX64.exe"; Parameters: "/install /quiet /norestart"; StatusMsg: "Installing 64-bit runtime..."; Check: Is64BitInstallMode And IsWebView2RuntimeNeeded; Flags: waituntilterminated
#endif

[Code]
function IsWebView2RuntimeNeeded(): boolean;
var
    Version: string;
    RuntimeNeeded: boolean;
    VerifyRuntime: boolean;
begin
    { See: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#detect-if-a-suitable-webview2-runtime-is-already-installed }

    RuntimeNeeded := true;
    VerifyRuntime := false;

    { Since we are using an elevated installer I am not checking HKCU }
    if (IsWin64) then
    begin
        { Test x64 }
        if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
        begin
            { We need to verify }
            VerifyRuntime := true;
        end
    else
    begin
        { Test x32 }
        if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
        begin
            { We need to verify }
            VerifyRuntime := true;
        end;
    end;

    { Verify the version information }
    if (VerifyRuntime) then
    begin
        if (Version <> '') and (Version <> '0.0.0.0') then
        begin
            Log('WebView2 Runtime is installed');
            RuntimeNeeded := false;
        end
        else
            Log('WebView2 Runtime needs to be downloaded and installed');
        end;
    end;

    Result := RuntimeNeeded;
end;
 
3 Likes

I’m still working on this

@Julien_Courtes1 thank you for providing your script. I added it to a test install project as-is but also included my installation folder/file in the [Files] section, and this still did not display the WebView2 control (show the video). I chose the Evergreen Standalone Installer x64 as suggested. The file shows it is being extracted when the installer is running, so I would assume it is installing it. I’ve been trying several different things like placing the app file to install after the prereqs instead of before but cannot get the WV2 video to display after the installer is created in Inno and run

This is on Xojo 2025 R2.1 and targeting Windows 10 and 11

Does anything special need to happen in Xojo, like in the Advanced Build section? Include Runtime DLLs, Include PDB, Use WinUI (Experimental). These are all checked to off. I noticed the target build switches are not available in 2025 R1 or 2.1 but they were in 2024 R3 so not sure if that is anything

Here is my Inno script. It’s nearly identical to the one Julien posted

[Files]
Source: “C:\Users\ryan_m121u5o\Desktop\Visual Veggies\Programs\a - for installers\vimeo via WebView2*”; 
DestDir: “{app}”; Flags: ignoreversion recursesubdirs createallsubdirs
Source: “VC_redist.x64.exe”; DestDir: “{tmp}”; Check: Is64BitInstallMode;
Source: “MicrosoftEdgeWebView2RuntimeInstallerX64.exe”; DestDir: “{tmp}”; Check: Is64BitInstallMode;

[Icons]
Name: “{autoprograms}{#MyAppName}”; Filename: “{app}{#MyAppExeName}”
Name: “{autodesktop}{#MyAppName}”; Filename: “{app}{#MyAppExeName}”; Tasks: desktopicon

[Run]
#ifdef x64
Filename: “{tmp}\VC_redist.x64.exe”; Parameters: “/install /quiet /norestart”; StatusMsg: “Installing 64-bit runtime…”; Check: Is64BitInstallMode; Flags: waituntilterminated
Filename: “{tmp}\MicrosoftEdgeWebView2RuntimeInstallerX64.exe”; Parameters: “/install /quiet /norestart”; StatusMsg: “Installing 64-bit runtime…”; Check: Is64BitInstallMode And IsWebView2RuntimeNeeded; Flags: waituntilterminated
#endif
Filename: “{app}{#MyAppExeName}”; Description: “{cm:LaunchProgram,{#StringChange(MyAppName, ‘&’, ‘&&’)}}”; Flags: nowait postinstall skipifsilent

[Code]
function IsWebView2RuntimeNeeded(): boolean;
var
Version: string;
RuntimeNeeded: boolean;
VerifyRuntime: boolean;
begin
{ See: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#detect-if-a-suitable-webview2-runtime-is-already-installed }

RuntimeNeeded := true;
VerifyRuntime := false;

{ Since we are using an elevated installer I am not checking HKCU }
if (IsWin64) then
begin
    { Test x64 }
    if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
    begin
        { We need to verify }
        VerifyRuntime := true;
    end
else
begin
    { Test x32 }
    if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
    begin
        { We need to verify }
        VerifyRuntime := true;
    end;
end;

{ Verify the version information }
if (VerifyRuntime) then
begin
    if (Version <> '') and (Version <> '0.0.0.0') then
    begin
        Log('WebView2 Runtime is installed');
        RuntimeNeeded := false;
    end
    else
        Log('WebView2 Runtime needs to be downloaded and installed');
    end;
end;

Result := RuntimeNeeded;

end;

I also compared the .dll files and folders in both the app’s Build folder and in the Program Files x86 folder, and they all match. Running the app from the Build folder shows and plays the video. Doing this from the installed PF x86 folder does not. Something is missing. I feel like I’m so close

How did you implement WebView2 as control inside the app?

Yes. I actually just copied it from William’s sample project in Issues and pasted it to mine. Was this not the correct approach, and can this cause a problem with the built installer app?

No, just asking to make sure I can help. I am using the MBS control where I do not see such issues. But that‘s a different approach of course, so I am out of ideas.

So I notice you selected the x64 Standalone Installer and your script is littered with x64 tags. But you’re installing into the Program Files x86 folder? Is your app 32 bit while the library you’re installing is 64 bit?

1 Like

This always confuses the heck out of me! The Architecture in the Build Settings under Windows is x86 64-bit, which is kind of misleading to me as to which prereq files need to be included. I tried modifying the Inno script using x86 to match the Program Files but still am getting a blank WebView2

If anyone would be so kind to check, I have the Xojo file (this is from the Issues unmodified) and the two Inno scripts attached.

WebView2.zip (4.1 KB)

WebView2 inno x64.zip (1.8 KB)

WebView2 inno x86.zip (1.8 KB)

Why is this being so difficult? I know someone else must be using WebView2 for videos and/or some other function on Windows. Not sure if something special needs to happen in Xojo or if I’m just missing something in the Inno script. I just cannot get it. I vaguely remember attempting to use the MBS WebView for videos a couple years ago but ran into the same problem when building the installer, so I gave up on it

I’m starting to think it’s related to 32/64bitness.

You need this flag ArchitecturesInstallIn64BitMode=x64 to allow your installer to install 64bit correctly.

You’ve got some scripts and conditionals in here… I’m not sure – I’d start with fixing the bitness.

1 Like

Thanks Tim. I’ll work on this Monday and see how it goes

Unfortunately, adding this flag (ArchitecturesInstallIn64BitMode=x64) did not do the trick. I even tried the one Advanced Build setting “Use WinUI (Experimental)”, but that was also a no-go

Anyone have any other suggestions?

MBS for the win!

I am now testing out using MBS WebView2 instead of the XAMLContainer. In my test app, the video now plays after the installer is created! I will soon be implementing this into my main app to ensure it still works, but I am very confident it will. I should have time to work on this today and tomorrow and will post back the results and hopefully mark this one as resolved

2 Likes