Remove unnecessary custom action

Type 51 custom actions, SetProperty, are mostly benign but if possible
custom actions should be avoided at all costs. Here we centralize the
build type check in a single location and use preprocessor variable to
remove the need for the custom action.
This commit is contained in:
Rob Mensching 2016-01-26 23:27:18 -08:00
parent 74f0c7a839
commit 49a992dd2d
3 changed files with 8 additions and 8 deletions

View file

@ -1,11 +1,14 @@
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension">
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include "Variables.wxi" ?>
<Fragment>
<Property Id="INSTALLEDCLIBUILDTYPE">
<RegistrySearch Id="DotnetCLI_BuildType" Type="raw"
Root="HKLM" Key="SOFTWARE\dotnet\Setup" Name="BuildType" Win64="$(var.Win64AttributeValue)"/>
</Property>
<SetProperty Before="LaunchConditions" Id="EXPECTEDCLIBUILDTYPE" Value="$(var.BuildType)" />
<Condition Message="$(var.IncompatibleBuildTypeError)">
NOT INSTALLEDCLIBUILDTYPE OR INSTALLEDCLIBUILDTYPE ~= "$(var.BuildType)"
</Condition>
</Fragment>
</Wix>

View file

@ -27,9 +27,6 @@
<CustomActionRef Id="WixBroadcastEnvironmentChange" />
<PropertyRef Id="INSTALLEDCLIBUILDTYPE"/>
<Condition Message="$(var.IncompatibleBuildTypeError)">
<![CDATA[NOT INSTALLEDCLIBUILDTYPE OR INSTALLEDCLIBUILDTYPE ~= EXPECTEDCLIBUILDTYPE]]>
</Condition>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">

View file

@ -20,10 +20,10 @@
<?define ProductEdition = "001dotnet" ?>
<?define LCID = "$(var.ProductLanguage)"?>
<?define DowngradeErrorMessage = "A newer version is already installed; please uninstall it and re-run setup."?>
<?define IncompatibleBuildTypeError = "You have installed '[INSTALLEDCLIBUILDTYPE]' build of Dotnet CLI. It cannot be upgraded to a '[EXPECTEDCLIBUILDTYPE]' build of Dotnet CLI. Please uninstall it and re-run setup."?>
<?define IncompatibleBuildTypeError = "You have installed '[INSTALLEDCLIBUILDTYPE]' build of Dotnet CLI. It cannot be upgraded to a '$(var.BuildType)' build of Dotnet CLI. Please uninstall it and re-run setup."?>
<?define Platform = "$(sys.BUILDARCH)" ?>
<?if $(var.Platform)=x86?>
<?if $(var.Platform)=x86?>
<?define Program_Files="ProgramFilesFolder"?>
<?define Win64AttributeValue=no?>
<?define UpgradeCode="70A1576F-63B6-4659-9E39-25C7B769DDE5"?>