Skip to content

Commit

Permalink
Publish Installer Samples (#56)
Browse files Browse the repository at this point in the history
* include wix. update some comment

* enable package by default

* rename projects

* comment on direcotry path

* test out publicKeyCertifacate

* runtime case

* update runtime fwlink eula

* update regkey path

* break up long comment

* break down long line comment

Co-authored-by: Diana Qu <[email protected]>
  • Loading branch information
dianaqu and Diana Qu authored Oct 16, 2020
1 parent 14062fe commit 8402697
Show file tree
Hide file tree
Showing 12 changed files with 503 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ packages/
*.aps

# Ignore files generated by midl
/HostObjectSample_h.h
/HostObjectSample_i.c
WebView2APISample/HostObjectSample_h.h
WebView2APISample/HostObjectSample_i.c

# Make sure script debug config is checked in for vendor testing
!.vscode

# Make sure testing use standalond installer and WVRT bootstrapper not included to project
MicrosoftEdgeWebview2Setup.exe
MicrosoftEdgeWebView2RuntimeInstallerX64.exe

# Make sure don't pick up the heat generated file
WV2DeploymentWiXCustomActionSample/HeatGeneratedFileList.wxs
1 change: 1 addition & 0 deletions SampleApps/WV2DeploymentVSInstallerSample/en/eula.rtf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This should be filled with your custom eula
34 changes: 34 additions & 0 deletions SampleApps/WV2DeploymentVSInstallerSample/en/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
***********************************************************************
Copyright (C) Microsoft Corporation. All rights reserved.
THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
***********************************************************************
-->

<Package
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture"
LicenseAgreement="eula.rtf">
<PackageFiles>
<PackageFile Name="eula.rtf"/>
</PackageFiles>

<!-- Defines a localizable string table for messages. -->
<Strings>
<String Name="DisplayName">Edge WebView2 runtime</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">Administrator permissions are required to install the Microsoft Edge WebView2 runtime.</String>
<String Name="GeneralFailure">A failure occurred attempting to install the Microsoft Edge WebView2 runtime.</String>
<!-- 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/. -->
<!-- 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.
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/). -->
<String Name="WebViewRuntime">https://go.microsoft.com/fwlink/p/?LinkId=2124703</String>
</Strings>
</Package>
55 changes: 55 additions & 0 deletions SampleApps/WV2DeploymentVSInstallerSample/product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
***********************************************************************
Copyright (C) Microsoft Corporation. All rights reserved.
THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
***********************************************************************
-->

<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Microsoft.Web.WebView2.WebView2Runtime">

<!-- Defines the list of files to be copied on build. -->
<PackageFiles CopyAllPackageFiles="false">
<!-- Download the MicrosoftEdgeWebview2Setup.exe and then invoke -->
<!-- Note that CertificatePublicKey, Hash, Size and Version are subject to change, and installer workflows requiring knowing these attributes ahead of time, such as WiX Bundle, may be broken. -->
<!-- We are working on supporting this technology with PublicKey Hash in the future. -->
<!-- <PackageFile Name="MicrosoftEdgeWebview2Setup.exe" HomeSite="WebViewRuntime" PublicKey="3082010a0282010100b39e84f35ccc2cc84dffe6b401629a4a6097a9d0c155c0a9df5d498ffbd546517ee82618e9170499f4ab4210fd8e8d57bfe0951228d73f551e0923bb80d684a8b7417ec20159e3cab8a7e3a50b4064996b0f6c9bf16452c778680a9b58ce7edea035b5b043ff0029993ea8a644accd2b514de27e98e3491eec5e59b653bbe71a5eddfbccf9c819304f82c08faca567fa5f39ecbceb67526fcfedcfeea273edb510259dda84e6cc6d5f8c49dc17bfa49459cbcf5d2259c0f7ee414a8ec197347229e94719285c8f997d5bd109903c5fb822e1c436f77ab1ac0c652ce4fe86edf50e8b1813d918f489b00714ceafa98a5393a117fba5b4636d3c3241cd3d2f6cf90203010001"/> -->

<!-- Package the MicrosoftEdgeWebview2Setup.exe and then invoke -->
<PackageFile Name="MicrosoftEdgeWebview2Setup.exe" />

<!-- Package the WebView Standalone Installer -->
<!-- <PackageFile Name="MicrosoftEdgeWebView2RuntimeInstallerX64.exe" /> -->
</PackageFiles>

<!-- Check for RegKey to make sure only install if WebView Run time are not installed -->
<InstallChecks>
<RegistryCheck Property="EdgeRuntimeVersionInstalled" Key="HKLM\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Value="pv"/>
</InstallChecks>

<!-- Defines how to run the Setup package. -->
<!-- /silent flag Arguments is not supported in this technology for now -->
<Commands Reboot="Defer">
<Command
PackageFile="MicrosoftEdgeWebview2Setup.exe"
Arguments=" /install"
EstimatedInstalledBytes="2600000"
EstimatedTempBytes="4500000"
EstimatedInstallSeconds="60">
<InstallConditions>
<BypassIf Property="EdgeRuntimeVersionInstalled" Compare="VersionGreaterThanOrEqualTo" Value="86.0.622.12"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
</Product>
29 changes: 29 additions & 0 deletions SampleApps/WV2DeploymentWiXBurnBundleSample/Bundle.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="WebView2SampleBootstrapper" Version="1.0.0.0" Manufacturer="Microsoft Corp." UpgradeCode="9a57a789-e554-4b42-b0b7-1a16345c2808">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Value="EBWebView" Variable="WVRTInstalled" Win64="no" />
<Chain>
<!-- Step 1: Chain WebView2 RunTime as Prerequisite -->
<!-- Vital="no" indicate this install will not fail the sequence. If this sequence failed, it will just move on to next install -->
<!-- If you want your app to fail if WebView2 Runtime failed to install, switch Vital value to yes -->

<!-- [Download Bootstrapper] Use fwlink to download bootstrapper to then invoke it-->
<!-- Note that CertificatePublicKey, Hash, Size and Version are subject to change, and installer workflows requiring knowing these attributes ahead of time, such as WiX Bundle, may be broken. -->
<!-- We are working on supporting this technology with CertificatePublicKey in the future. -->
<!-- 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/. -->
<!-- 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.
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/). -->
<!-- <ExePackage Id="DownloadAndInvokeBootstrapper" Name="Install WebView2 Runtime" Cache="no" Compressed="no" PerMachine="yes" Vital="no" DownloadUrl="https://go.microsoft.com/fwlink/p/?LinkId=2124703" InstallCommand=" /silent /install" InstallCondition="NOT (REMOVE OR WVRTInstalled)">
<RemotePayload ProductName="MicrosoftEdgeWebview2Setup" Description="Microsoft Edge WebView2 Update Setup" CertificatePublicKey="1392A8505C3B192F62311EA9005E49C1B5358F6B" Hash="82B42348804E8D82C773DC3391B691712BB1B388" Size="1815832" Version="1.3.135.41"/>
</ExePackage> -->

<!-- [Package Bootstrapper] Package bootstrapper to use during app install. Source can be anywhere you put the boostrapper on. -->
<!-- <ExePackage Id="DownloadAndInvokeBootstrapper" Name="Install WebView2 Runtime" Cache="no" Compressed="no" PerMachine="yes" Vital="no" SourceFile="..\MicrosoftEdgeWebview2Setup.exe" InstallCommand=" /silent /install" InstallCondition="NOT (REMOVE OR WVRTInstalled)" /> -->

<!-- Step 2: Chain Sample App -->
<!-- Make sure to comment out default Custom Action in WebView2SampleApp project -->
<MsiPackage Id="WV2DeploymentWiXCustomActionSampleMsi" SourceFile="$(var.WV2DeploymentWiXCustomActionSample.TargetDir)\WV2DeploymentWiXCustomActionSample.msi" Permanent="no" DisplayInternalUI="yes" Compressed="yes" Vital="yes"/>
</Chain>
</Bundle>
</Wix>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>352113bf-fb17-4fd4-a47b-7d1013bfb8ae</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>WV2DeploymentWiXBurnBundleSample</OutputName>
<OutputType>Bundle</OutputType>
<Name>WV2DeploymentWiXBurnBundleSample</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Bundle.wxs" />
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
<WixExtension Include="WixBalExtension">
<HintPath>$(WixExtDir)\WixBalExtension.dll</HintPath>
<Name>WixBalExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WV2DeploymentWiXCustomActionSample\WV2DeploymentWiXCustomActionSample.wixproj">
<Name>WV2DeploymentWiXCustomActionSample</Name>
<Project>{3494e3e2-cb03-4283-b8f8-e1158cdbaf3f}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
85 changes: 85 additions & 0 deletions SampleApps/WV2DeploymentWiXCustomActionSample/Product.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="WV2DeploymentWiXCustomActionSample" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft Corp." UpgradeCode="3bf3b84c-e140-4276-81bd-23f461b01f71">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<MediaTemplate EmbedCab="yes"/>

<!-- Precondition: Check whether WebView RunTime already installed or not -->
<Property Id="WVRTINSTALLED">
<RegistrySearch Id="WVRTInstalled" Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="EBWebView" Type="raw" Win64="no"/>
</Property>

<!-- Step 1: Define installation folder -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLFOLDER" Name="WV2DeploymentWiXCustomActionSample"/>
</Directory>

<!-- Step 2: Add files to your installer package -->
<DirectoryRef Id="INSTALLFOLDER">
<!-- Using Project References and Variables: https://wixtoolset.org/documentation/manual/v3/votive/votive_project_references.html -->
<!-- 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. -->
<!-- <Component Id="WebView2APISample.exe" Guid="2DC56D26-A5CC-40ED-81C5-441042F2C46B">
<File Id="WebView2APISample.exe" Source="$(var.WebView2APISample.TargetDir)\WebView2APISample.exe" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="WebView2Loader.dll" Guid="624B4B28-4D7F-49D8-9CAD-279FC2AC8D25">
<File Id="WebView2Loader.dll" Source="$(var.WebView2APISample.TargetDir)\WebView2Loader.dll" KeyPath="yes"/>
</Component> -->
</DirectoryRef>

<!-- Step 3: Tell WiX to install the files -->
<Feature Id="MainApplication" Title="Main Application" Level="1" ConfigurableDirectory='INSTALLFOLDER'>
<!-- Include files to your project by listing it one by one. Only showing key component in one project. -->
<!--<ComponentRef Id="WebView2APISample.exe"/>
<ComponentRef Id="WebView2Loader.dll"/>-->

<!-- Include files to your project by using heat to auto generate the file list. No need for DirectoryRef section. -->
<!-- See project file for details -->
<ComponentGroupRef Id="AppComponent" />
</Feature>

<!-- [Custom UI] Let User choose install location -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/>
<UIRef Id="WixUI_InstallDir"/>

<!-- Step 4: Config Custom Action to download/install Bootstrapper -->
<!-- Reference: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#understand-the-webview2-runtime-and-installer-preview -->
<!-- Note: PerMachine case, user can use Impersonate="no" to run MicrosoftEdgeWebview2Setup.exe elevated with /silent flag to install WebView Runtime silently-->

<!-- [Package Standalone Installer] Package Standalone Installer as binary stream to use during app install. SourceFile can be anywhere you put the Standalone Installer on. -->
<!-- <Binary Id="MicrosoftEdgeWebView2RuntimeInstallerX64.exe" SourceFile="..\MicrosoftEdgeWebView2RuntimeInstallerX64.exe"/>
<CustomAction Id='InvokeStandalone' BinaryKey='MicrosoftEdgeWebView2RuntimeInstallerX64.exe' Execute="deferred" ExeCommand=' /install' Return='check' /> -->

<!-- [Package Bootstrapper] Package bootstrapper as binary stream to use during app install. Source can be anywhere you put the boostrapper on. -->
<!-- <Binary Id="MicrosoftEdgeWebview2Setup.exe" SourceFile="..\MicrosoftEdgeWebview2Setup.exe"/>
<CustomAction Id='InvokeBootstrapper' BinaryKey='MicrosoftEdgeWebview2Setup.exe' Execute="deferred" ExeCommand=' /install' Return='check' /> -->

<!-- [Download Bootstrapper] Use fwlink to download bootstrapper to user TEMP folder then invoke it-->
<!-- Note: Download will be overrided if file already exist. -->
<!-- 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/. -->
<!-- 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.
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/). -->
<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" ; &amp; $env:TEMP\MicrosoftEdgeWebview2Setup.exe /install' Return='check'/>

<!-- Step 5: Config execute sequence of custom action -->
<InstallExecuteSequence>
<!-- [Package Standalone Installer] Package Standalone Installer and invoke at app installation -->
<!-- Only run InvokeStandalone action during app install, app repair and when WVRT wasn't installed-->
<!-- <Custom Action='InvokeStandalone' Before='InstallFinalize'>
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
</Custom> -->

<!-- [Package Bootstrapper] Package bootstrapper and invoke at app installation-->
<!-- Only run InvokeBootstrapper action during app install, app repair and when WVRT wasn't installed-->
<!-- <Custom Action='InvokeBootstrapper' Before='InstallFinalize'>
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
</Custom> -->

<!-- [Download Bootstrapper] Use fwlink to download the bootstrapper to user TEMP folder and invoke-->
<!-- Only run DownloadAndInvokeBootstrapper action during app install, app repair and when WVRT wasn't installed-->
<Custom Action='DownloadAndInvokeBootstrapper' Before='InstallFinalize'>
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns="http://schemas.microsoft.com/wix/2006/wi" version="1.0" exclude-result-prefixes="xsl wix">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<!-- By default, copy all elements and nodes into the output. -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<!-- Make sure files generated by running WebView2APISample.exe are not included -->
<xsl:key name="file-search" match="wix:Component[contains(wix:File/@Source, 'WebView2APISample.exe.WebView2')]" use="@Id"/>

<!-- Sample code on if end developer chose to exclude the pdb files -->
<xsl:key name="file-search" match="wix:Component[contains(wix:File/@Source, '.pdb')]" use="@Id"/>

<!-- Do Nothing to these files if key file-search are found. -->
<xsl:template match="wix:Component[key('file-search', @Id)]"/>
<xsl:template match="wix:ComponentRef[key('file-search', @Id)]"/>
</xsl:stylesheet>
Loading

0 comments on commit 8402697

Please sign in to comment.