I'm currently working on a bundle installer using Wix Toolset. The bundle contains three parts, one being an apropriate .Net Runtime.
I'm using the following query to get the currently installed .Net version:
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64\sharedhost"
Value="Version"
Win64="yes"
Variable="NetVersion"
/>
I then use the variable in the following ExePackage
<ExePackage SourceFile="D:\somepath\windowsdesktop-runtime-5.0.7-win-x64.exe"
Vital="no"
PerMachine="yes"
InstallCondition="VersionNT64 AND NetVersion < v5.0.7"/>
The second part of the statement: NetVersion < v5.0.7 always evaluates to false. It doesn't matter if I compare against, say version 4.0 or 7.0, the installer wont show up in the process.
Maybe the problem has something to do with the installed dotnet version on my computer, which happen to be 6.0.0-preview.5.21301.5.
I'm using an other query where I check against a more conservative version number (major.minor.build.revision) which works just fine.
Im using Wix toolset 3.11.
Any help is appreciated!
Have you tried removing the "v" in the compare-expression?
Related
I have installed wix as a plugin in Visual studio. I am trying to search for if MATLAB Version 9.2 exists on the PC then allow installation or else abort. To achieve this I do like this
<Property Id="MATLABRUNTIMEEXISTS">
<RegistrySearch Id="Matlab_runtime_search"
Root="HKLM"
Key="SOFTWARE\MathWorks\MATLAB Runtime\9.2"
Name =" MATLABROOT"
Win64="yes"
Type="raw"/>
</Property>
<Condition Message="This application requires RUNTIME 9.2. Please install the Matlab runtime 9.2 then run this installer again.">
<![CDATA[Installed OR MATLABRUNTIMEEXISTS]]>
</Condition>
It works fine, and installer is halted when there is no MATLAB on PC. But even after installing MATLAB it stops the installer.
The MATLABROOT key is "REG_SZ" and "C:\Program Files\MATLAB\MATLAB Runtime".
So what I want to test is actually only the presence of MATLABROOT key.
I saw in other questions people are using <util:RegistrySearch>, but I am not able to use that. I receive error "unsupported extension element", even though I have UtilExtension as reference already added.
Could anyone suggest me what I need to do to actually make it work?
I've got myself into a bit of state with a version of my WiX Bootstrapper that is out in the field and am struggling to see how I can get round my problem with the new version.
Basically the version that is out there has a couple of MSIPackage elements that installs SQL CLR & SMO using Mircosoft's standard MSIs (SQLSysClrTypes.msi & SharedManagementObjects.msi) - but unfortunately they are the x64 versions. Now that's fine for 64bit PCs (as our app can use the 64bit version) and so on those PCs all is ok. But obviously when someone tries and installs it on a 32bit machine, it fails.
So, what I'm wanting the new setup.exe to do; is to detect if the 64bit version is installed & it's version (which I do via a Registry search); if it is, then don't do anything (ie don't install the x86 version). Also detect if the x86 version is installed & it's version (again I can do this) - then only install the x86 version; if neither the x86 or the x64 version is installed ( or they are not the correct version - in this case v13.0.1601.5)
My logic for this was:
<util:RegistrySearch Id="IsSMOInstalledx86"
Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server\SharedManagementObjects\CurrentVersion"
Value="Version"
Result="value"
Variable="SMOVersionx86"/>
<util:RegistrySearch Id="IsSMOInstalledx64"
Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server\SharedManagementObjects\CurrentVersion"
Value="Version"
Win64="yes"
Result="value"
Variable="SMOVersionx64"/>
and
<MsiPackage SourceFile="$(var.DependenciesPath_Microsoft)\System CLR Types for SQL Server 2016\v13.0.1601.5\SQLSysClrTypes.msi"
Id="SQLCLR"
DisplayName="System CLR Types for SQL Server 2016"
Visible="yes"
InstallCondition="(SMOVersionx86 <> "13.0.1601.5") AND (SMOVersionx64 <> "13.0.1601.5")"
SuppressSignatureVerification="yes"/>
<MsiPackage SourceFile="$(var.DependenciesPath_Microsoft)\Shared Management Objects\v13.0.1601.5\SharedManagementObjects.msi"
Id="SQLSMO"
After="SQLCLR"
DisplayName="Shared Management Objects for SQL Server 2016"
Visible="yes"
InstallCondition="(SMOVersionx86 <> "13.0.1601.5") AND (SMOVersionx64 <> "13.0.1601.5")"
SuppressSignatureVerification="yes"/>
But my problem is that when this is run on a 64bit PC (where SMO is already installed) - the InstallCondition evaluates to FALSE and as the WiX documentation clearly states; if it evaluates to FALSE, then the product is UNINSTALLED - which is obviously not what I want.
There is never a situation that I want the InstallCondition to evaluate to FALSE i.e. I never should uninstall SMO (if for no other reason, than the user may have installed that for a different app to use i.e. not one of ours). I could remove the installCondition and then it would just install the x86 version on both 32bit and 64bit machines - which is fine; but a bit naff.
So, what I want to do in pseudo code, is something like:
If SMOVersionx86 <> "13.0.1601.5" AND SMOVersionx64 <> "13.0.1601.5"
then
call the MSIPackages (with no installcondition or always TRUE) to INSTALL
else
don't call the MSIPackages"
Endif
i.e. if the condition results in FALSE; then I don't want to do anything ... certainly don't want to call the MSIPackages with FALSE, as this would UNINSTALL them.
I've racked my brain with all sorts of ideas, but they all in some circumstances end up with the installCondition evaluating to false and so end up removing SMO. I thought that perhaps I could have some logic that does install the x64 version on a 64bit PC and the x86 version on a 32bit PC, but even then at least one of the MSIPackage's installcondition would evaluate to false and end up removing a version !!
Any help on this would be gratefully received !!
Cheers,
Big Chris.
MsiPackage has a property Permanent that declares whether a package can be uninstalled. Setting it to "yes" will prevent the bundle from attempting to uninstall it.
However, I'm not sure if adding that property to a new bundle will prevent the old bundle from uninstalling it.
I have a WIX installer which I need to also install the VC++ 2015 runtime executable. I'm using the vcredist_x64.exe as opposed to the merge modules (see this thread). I can successfully launch the vcredist_x64.exe after my msi finishes installing my application by using a custom action... however, what I'd like to do is first check to see if the runtime files already exist. If they do, then I'll just finish without running the vcredist_x64.exe. Otherwise, I'll run the custom action to install the runtimes as well.
It took some digging, but I was able to find out that the 2015 runtimes have a registry key shown below:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64
with an Installed value of 1 if they exist.
So, in my .wxs file I have the following registry search:
<!-- Visual C++ 2015 x64 -->
<Property Id="VCREDISTRUNTIMES2015INSTALLED">
<RegistrySearch Id="VCREDISTRUNTIMES2015SEARCH" Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" Name="Installed" Type="raw" />
</Property>
Now, what I'd like to do is show a message on my exit dialog which says that if the runtimes aren't detected, then it will launch an installer to install them upon exit. Something like this:
<Property Id="WIXUI_EXITDIALOGOPTIONALTEXT" Value="Visual C++ Redistributable for Visual Studio 2015 is Required. Installation will proceed on exit.">
<Condition>VCREDISTRUNTIMES2015INSTALLED</Condition>
</Property>
However, this doesn't work. I get an error on the conditional tag and the project wont build. Assuming my registry search is setup correctly, can someone tell me how to properly add a conditional message on my exit dialog? Thanks!
Answering my own question... but here goes. It turns out that my registry search was just fine... but I needed to use "SetProperty" instead. So, something like this:
<SetProperty Id="WIXUI_EXITDIALOGOPTIONALTEXT" After="AppSearch" Value="The Visual C++ Redistributable Package for Visual Studio 2015 is Required. Installation will now install run-time components that are required to run C++ applications built using Visual Studio 2015.">
NOT VCREDISTRUNTIMES2015INSTALLED
</SetProperty>
Now, if the VCREDISTRUNTIMES2015INSTALLED is null (or false) then it will show the message on the exit dialog. Otherwise, there will be no message shown. Hope that helps.
I am new to Wix Toolset installation. I am using Wix 3.7 and Visual Studio 2010 SP1.
I was going through a tutorial which uses BootStrapper in which there is a conditional Message in Product.Wxs file for checking .NET framework 4.0 is installed there is a PropertyRef Id variable and Condition Message
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Condition Message="This application requires .NET Framework 4.0. Please install the .NET Framework then run
this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
How can one similarly check for Condition for Windows XP Starter/Home and Windows 7 Starter/Home/Home Premium editions and show conditional message that the installation does not support the OS listed and require Professional Editions.
I have gone through the links on Wixtoolset website, but it didn't help:
Checking Windows Versions
http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/block_install_on_os.html
http://msdn.microsoft.com/library/aa370556.aspx
I have also tried to place the condition in the bootstrapper's Bundle.wxs file as:
<Bundle Name="!(loc.ProductName)" Compressed="yes" Version="1.2.6.0"
SplashScreenSourceFile="Resources\SplashScreen.bmp" IconSourceFile="Resources\IXMWeb.ico" Manufacturer="!
(loc.ManufacturerName)" UpgradeCode="FED377E5-8762-48C4-B123-8D4AD89B0222" Condition="((VersionNT >= v5.1) AND
(ServicePackLevel >= 3) AND NOT(NTSuitePersonal)) OR ((VersionNT >= v5.2) AND (ServicePackLevel >= 2)) OR
(VersionNT >= v6.0 AND NOT(NTSuitePersonal))">
I have gone through the post that I need to use NTSuitePersonal instead of MsiNTSuitePersonal for checking if the edition is Home edition which is being installed.
Please let me know where i am not correct in the above condition used.
For checking the Windows version (i.e. Windows XP, Vista, 7, 8, ...) you can use the VersionNT-property as described in the links provided by you. For checking the edition (i.e. Home, Premium, Professional, ...), according to this SO-question, you can use the values below the registry hive HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion.
In combination with WiX you could do a registry search that sets a property and then use this property in your condition (I could verify the exact registry key only on Windows 7 Professional where it is names EditionID):
...
<Property Id="WINDOWSEDITION" Secure="yes">
<RegistrySearch Id="WindowsEditionReg" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Name="EditionID" Type="raw" />
</Property>
...
See also How to: Read a registry entry during installation.
Edit: Using the properties named in your link Operating System Property Values and the How To: Read a Registry Entry During Installation and the How To: Block Installation Based on OS Version, an example of checking if the user has Windows 7 Professional with Service Pack 1 installed and deny the installation on everything else would then be (put it inside the Product-tag):
<Condition Message="This application can only be installed on Windows 7 Professional with Service Pack 1.">
<![CDATA[Installed OR (VersionNT = 601 AND WindowsBuild > 7100 AND WINDOWSEDITION ~= "Professional")]]>
</Condition>
The Installed-property on the beginning of the condition ensures that the condition is only validated if the product isn't already installed. Within the parenthesis we then find the other conditional elements. We ensure that we run on Windows 7 (VersionNT = 601 AND WindowsBuild > 7100) and that the edition is correct (WINDOWSEDITION ~= "Professional"). Note that the ~= checks the string case insensitive.
For the syntax of the conditional statements you can take a look here. You can of course combine any additional conditions using OR, AND and grouping them with parentheses where appropriate. In a real world scenario you would most probably have another condition, like Windows 7 and higher versions.
I need to deploy a software setup targeting both, Windows 64bit and 32bit. I have two separate Windows Installer databases (created with WiX) for each platform, and I am using dotNetInstaller to combine both into a single installation bootstrapper executable.
I'm currently using version 1.10 of dotNetInstaller and set auto_close_if_installed=True, because I want to comletely hide the bootstrapper from the user. Still, dotNetInstaller insists on displaying a sill progress bar window while my installer is running, and doesn't really auto-close. The user needs to confirm a dialog box telling him that the application was successfully installed. But the real deal-breaker is that it doesn't support Windows 8 (yet).
Upgrading to a later version of dotNetInstaller seems to break auto_close_if_installed, so it's even worse.
So my question is: what is the current state of the art to deploy both setups in a single executable. Would Wix Burn be an option?
I know that in an ideal world, I simply provide my customers with separate installers for either platform. But they happen to be completely unaware of such subtleties, most of them don't even know what platform they are using.
I would definitely use Burn in this scenario. Something akin to the following:
<Wix>
<Bundle...>
<BootstrapperApplicationRef Id='WixStandardBootstrapperApplication.HyperlinkLicense' />
<Chain>
<MsiPackage InstallCondition='NOT VersionNT64' SourceFile='path\to\x86.msi' />
<MsiPackage InstallCondition='VersionNT64' SourceFile='path\to\x64.msi' />
</Chain>
</Bundle>
</Wix>
This is exactly one of the scenarios Burn was designed to handle.
You can do it in a single Wix via Conditions and Features.
<Feature Id='X86' Level='1'>
<ComponentRef Id='X86Feature1' />
<Condition Level="1">NOT VersionNT64</Condition>
</Feature>