|
| 1 | +--- |
| 2 | +description: "Demonstrate the deployment workflow of WebView2 with VS installer." |
| 3 | +extendedZipContent: |
| 4 | + - |
| 5 | + path: SharedContent |
| 6 | + target: SharedContent |
| 7 | + - |
| 8 | + path: LICENSE |
| 9 | + target: LICENSE |
| 10 | +languages: |
| 11 | + - cpp |
| 12 | +page_type: sample |
| 13 | +products: |
| 14 | + - microsoft-edge |
| 15 | +urlFragment: WV2DeploymentVSInstallerSample |
| 16 | +--- |
| 17 | +# WebView2 Deployment VS Installer Sample |
| 18 | + |
| 19 | +To help developers understand how to [deploy the Evergreen WebView2 Runtime](https://docs.microsoft.com/microsoft-edge/webview2/concepts/distribution#deploying-the-evergreen-webview2-runtime) with your application, this sample uses the [Microsoft Visual Studio Installer Projects](https://marketplace.visualstudio.com/items?itemName=visualstudioclient.MicrosoftVisualStudio2017InstallerProjects) to create an installer for [WebView2APISample](./SampleApps/WebView2APISample/README.md) and chain-install the Evergreen WebView2 Runtime. |
| 20 | + |
| 21 | +This sample showcases [deployment workflows](https://docs.microsoft.com/microsoft-edge/webview2/concepts/distribution#deploying-the-evergreen-webview2-runtime) for, |
| 22 | + |
| 23 | +* Download the Evergreen WebView2 Runtime Bootstrapper through link. |
| 24 | +* Package the Evergreen WebView2 Runtime Bootstrapper. |
| 25 | +* Package the Evergreen WebView2 Runtime Standalone Installer. |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | + |
| 29 | +* [Visual Studio](https://visualstudio.microsoft.com/vs/) with C++ support installed. |
| 30 | +* [Microsoft Visual Studio Installer Projects](https://marketplace.visualstudio.com/items?itemName=visualstudioclient.MicrosoftVisualStudio2017InstallerProjects). |
| 31 | + |
| 32 | +## Build steps |
| 33 | + |
| 34 | +To create a VS installer that chain-install the Evergreen WebView2 Runtime, |
| 35 | + |
| 36 | +1. Edit the `product.xml` file depending on the workflow you wish to use. |
| 37 | + * For "Package the Evergreen WebView2 Runtime Bootstrapper", |
| 38 | + * Within the `<PackageFiles CopyAllPackageFiles="false">` and `</PackageFiles>` section, un-comment the line `<PackageFile Name="MicrosoftEdgeWebview2Setup.exe" />`, and comment out other lines. |
| 39 | + * Within the `<Commands Reboot="Defer">` and `</Commands>` section, make sure `PackageFile` points to `"MicrosoftEdgeWebview2Setup.exe"` so that the VS installer would be using the Bootstrapper. |
| 40 | + * For "Download the Evergreen WebView2 Runtime Bootstrapper through link", |
| 41 | + * Within the `<PackageFiles CopyAllPackageFiles="false">` and `</PackageFiles>` section, un-comment the line `<PackageFile Name="MicrosoftEdgeWebview2Setup.exe" HomeSite="WebViewRuntime" PublicKey="..."/>`, and comment out other lines. Note that the PublicKey for the WebView2 Runtime Bootstrapper may change without notice and we are working on addressing this issue. For now, you may need to replace it with an updated PublicKey. |
| 42 | + * Within the `<Commands Reboot="Defer">` and `</Commands>` section, make sure `PackageFile` points to `"MicrosoftEdgeWebview2Setup.exe"` so that the VS installer would be using the Bootstrapper. |
| 43 | + * For "Package the Evergreen WebView2 Runtime Standalone Installer", |
| 44 | + * Within the `<PackageFiles CopyAllPackageFiles="false">` and `</PackageFiles>` section, un-comment the line `<PackageFile Name="MicrosoftEdgeWebView2RuntimeInstallerX64.exe" />`, and comment out other lines. |
| 45 | + * Within the `<Commands Reboot="Defer">` and `</Commands>` section, make sure `PackageFile` points to `"MicrosoftEdgeWebView2RuntimeInstallerX64.exe"` so that the VS installer would be using the Standalone Installer. |
| 46 | + * If you're targeting non-X64 devices, you may also want to edit the `MicrosoftEdgeWebView2RuntimeInstallerX64` filename to reflect the correct architecture. |
| 47 | +1. If you plan to package either the Bootstrapper or the Standalone Installer, [download](https://developer.microsoft.com/microsoft-edge/webview2/) the Bootstrapper or the Standalone Installer and place it under the `WV2DeploymentVSInstallerSample` folder. |
| 48 | +1. Copy the entire `WV2DeploymentVSInstallerSample` folder, and paste it under either, |
| 49 | + * `Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\`, or |
| 50 | + * `<VS Install Dir>\MSBuild\Microsoft\VisualStudio\BootstrapperPackages\` (requires at least VS 2019 Update 7). |
| 51 | +1. Create a Setup Project in Visual Studio. |
| 52 | + * In Visual Studio menu, select `File > New > Project`. |
| 53 | + * Search for `Setup Project`. |
| 54 | +  |
| 55 | + * Create a Setup Project. |
| 56 | +1. Add WebView2 Runtime as a prerequisite. |
| 57 | + * In Visual Studio menu, select `Project > Properties`. |
| 58 | + * In the Property page, select `Prerequisites..`. |
| 59 | +  |
| 60 | + * Check `Edge WebView2 runtime`, and un-check other prerequisites. Select `OK`. |
| 61 | +  |
| 62 | +1. Build the Setup project. |
0 commit comments