|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> |
| 3 | + <Product Id="*" Name="WV2DeploymentWiXCustomActionSample" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft Corp." UpgradeCode="3bf3b84c-e140-4276-81bd-23f461b01f71"> |
| 4 | + <Package InstallerVersion="200" Compressed="yes" InstallScope="perUser"/> |
| 5 | + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/> |
| 6 | + <MediaTemplate EmbedCab="yes"/> |
| 7 | + |
| 8 | + <!-- Precondition: Check whether WebView RunTime already installed or not --> |
| 9 | + <Property Id="WVRTINSTALLED"> |
| 10 | + <RegistrySearch Id="WVRTInstalled" Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="EBWebView" Type="raw" Win64="no"/> |
| 11 | + </Property> |
| 12 | + |
| 13 | + <!-- Step 1: Define installation folder --> |
| 14 | + <Directory Id="TARGETDIR" Name="SourceDir"> |
| 15 | + <Directory Id="INSTALLFOLDER" Name="WV2DeploymentWiXCustomActionSample"/> |
| 16 | + </Directory> |
| 17 | + |
| 18 | + <!-- Step 2: Add files to your installer package --> |
| 19 | + <DirectoryRef Id="INSTALLFOLDER"> |
| 20 | + <!-- Using Project References and Variables: https://wixtoolset.org/documentation/manual/v3/votive/votive_project_references.html --> |
| 21 | + <!-- Include files to your project by listing it one by one. Only showing key component in one project. No need if choose to use harvest. --> |
| 22 | + <!-- <Component Id="WebView2APISample.exe" Guid="2DC56D26-A5CC-40ED-81C5-441042F2C46B"> |
| 23 | + <File Id="WebView2APISample.exe" Source="$(var.WebView2APISample.TargetDir)\WebView2APISample.exe" KeyPath="yes" Checksum="yes"/> |
| 24 | + </Component> |
| 25 | + <Component Id="WebView2Loader.dll" Guid="624B4B28-4D7F-49D8-9CAD-279FC2AC8D25"> |
| 26 | + <File Id="WebView2Loader.dll" Source="$(var.WebView2APISample.TargetDir)\WebView2Loader.dll" KeyPath="yes"/> |
| 27 | + </Component> --> |
| 28 | + </DirectoryRef> |
| 29 | + |
| 30 | + <!-- Step 3: Tell WiX to install the files --> |
| 31 | + <Feature Id="MainApplication" Title="Main Application" Level="1" ConfigurableDirectory='INSTALLFOLDER'> |
| 32 | + <!-- Include files to your project by listing it one by one. Only showing key component in one project. --> |
| 33 | + <!--<ComponentRef Id="WebView2APISample.exe"/> |
| 34 | + <ComponentRef Id="WebView2Loader.dll"/>--> |
| 35 | + |
| 36 | + <!-- Include files to your project by using heat to auto generate the file list. No need for DirectoryRef section. --> |
| 37 | + <!-- See project file for details --> |
| 38 | + <ComponentGroupRef Id="AppComponent" /> |
| 39 | + </Feature> |
| 40 | + |
| 41 | + <!-- [Custom UI] Let User choose install location --> |
| 42 | + <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/> |
| 43 | + <UIRef Id="WixUI_InstallDir"/> |
| 44 | + |
| 45 | + <!-- Step 4: Config Custom Action to download/install Bootstrapper --> |
| 46 | + <!-- Reference: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#understand-the-webview2-runtime-and-installer-preview --> |
| 47 | + <!-- Note: PerMachine case, user can use Impersonate="no" to run MicrosoftEdgeWebview2Setup.exe elevated with /silent flag to install WebView Runtime silently--> |
| 48 | + |
| 49 | + <!-- [Package Standalone Installer] Package Standalone Installer as binary stream to use during app install. SourceFile can be anywhere you put the Standalone Installer on. --> |
| 50 | + <!-- <Binary Id="MicrosoftEdgeWebView2RuntimeInstallerX64.exe" SourceFile="..\MicrosoftEdgeWebView2RuntimeInstallerX64.exe"/> |
| 51 | + <CustomAction Id='InvokeStandalone' BinaryKey='MicrosoftEdgeWebView2RuntimeInstallerX64.exe' Execute="deferred" ExeCommand=' /install' Return='check' /> --> |
| 52 | + |
| 53 | + <!-- [Package Bootstrapper] Package bootstrapper as binary stream to use during app install. Source can be anywhere you put the boostrapper on. --> |
| 54 | + <!-- <Binary Id="MicrosoftEdgeWebview2Setup.exe" SourceFile="..\MicrosoftEdgeWebview2Setup.exe"/> |
| 55 | + <CustomAction Id='InvokeBootstrapper' BinaryKey='MicrosoftEdgeWebview2Setup.exe' Execute="deferred" ExeCommand=' /install' Return='check' /> --> |
| 56 | + |
| 57 | + <!-- [Download Bootstrapper] Use fwlink to download bootstrapper to user TEMP folder then invoke it--> |
| 58 | + <!-- Note: Download will be overrided if file already exist. --> |
| 59 | + <!-- Use of the download link below is governed by the below terms. You may acquire the link for your use at https://developer.microsoft.com/microsoft-edge/webview2/. --> |
| 60 | + <!-- Microsoft owns all legal right, title, and interest in and to the WebView2 Runtime Bootstrapper ("Software") and related documentation, including any intellectual property in the Software. |
| 61 | + You must acquire all code, including any code obtained from a Microsoft URL, under a separate license directly from Microsoft, including a Microsoft download site (e.g., https://developer.microsoft.com/microsoft-edge/webview2/). --> |
| 62 | + <CustomAction Id='DownloadAndInvokeBootstrapper' Directory="INSTALLFOLDER" Execute="deferred" ExeCommand='powershell.exe -windowstyle hidden Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" ; & $env:TEMP\MicrosoftEdgeWebview2Setup.exe /install' Return='check'/> |
| 63 | + |
| 64 | + <!-- Step 5: Config execute sequence of custom action --> |
| 65 | + <InstallExecuteSequence> |
| 66 | + <!-- [Package Standalone Installer] Package Standalone Installer and invoke at app installation --> |
| 67 | + <!-- Only run InvokeStandalone action during app install, app repair and when WVRT wasn't installed--> |
| 68 | + <!-- <Custom Action='InvokeStandalone' Before='InstallFinalize'> |
| 69 | + <![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]> |
| 70 | + </Custom> --> |
| 71 | + |
| 72 | + <!-- [Package Bootstrapper] Package bootstrapper and invoke at app installation--> |
| 73 | + <!-- Only run InvokeBootstrapper action during app install, app repair and when WVRT wasn't installed--> |
| 74 | + <!-- <Custom Action='InvokeBootstrapper' Before='InstallFinalize'> |
| 75 | + <![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]> |
| 76 | + </Custom> --> |
| 77 | + |
| 78 | + <!-- [Download Bootstrapper] Use fwlink to download the bootstrapper to user TEMP folder and invoke--> |
| 79 | + <!-- Only run DownloadAndInvokeBootstrapper action during app install, app repair and when WVRT wasn't installed--> |
| 80 | + <Custom Action='DownloadAndInvokeBootstrapper' Before='InstallFinalize'> |
| 81 | + <![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]> |
| 82 | + </Custom> |
| 83 | + </InstallExecuteSequence> |
| 84 | + </Product> |
| 85 | +</Wix> |
0 commit comments