I'm creating an installer for one of our products. The installer was done with WISE earlier but we wanted to change this to wix with this release. It's important that our users uninstall the old version of the product before installing the new version and thus I need to check for a key in the registry that was created by the old installer (the key is removed when the old version is uninstalled).
I have a conditional check in the wxs like so:
<!-- Check if older version of Product has been installed. Must be removed by user-->
<!-- The key below is set by the old installer. If it exists, the old version is there.-->
<Property Id="OLDKEY">
<RegistrySearch Id="OldRegKey" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Company Product för Product" Name="DisplayName" Type="raw"></RegistrySearch>
</Property>
<Condition Message="You need to uninstall the old version of Product before installing this one.">
OLDKEY
</Condition>
You'll notice a Swedish character in there. I suspect this might be the cause of some problems. This is how I configured since I had to handle Swedish characters:
<Product
Id="*"
Name="$(var.Manufacturer) $(var.ApplicationName)"
Language="1033"
Version="!(bind.FileVersion.Product.exe)"
Manufacturer="$(var.Manufacturer) AB"
UpgradeCode="[GUID]"
Codepage="1252"
>
Notice the 1252 codepage.
When I install and have the old version on the machine, I find the key in the registry and the installer will show me the message. If I remove the old version I can see the registry key disappear but the installer will still show me the message and exit. I have tried rebooting (you never know) to no avail.
I'm running out of ideas... any thoughts?
Turns out the registry search returns 1 if key is not found. So I changed
OLDKEY
To
<![CDATA[OLDKEY <> 1]]>
And it was fixed.
Related
I am trying to add a prerequisite for ASP.Net but the registry check to determine if its already installed fails.
I have the Active solution platform set to x64 to avoid registry redirect:
Active solution platform
In product.xml
<InstallChecks>
<RegistryCheck Property="AspNetCoreCheck" Key="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\v6.0\6.0.8" Value="Version" />
</InstallChecks>
My registry key on the install machine:
Registry
But install.log reports that it is not there:
Reading value 'Version' of registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\v6.0\6.0.8'
Unable to read registry value
Not setting value for property 'AspNetCoreCheck'
I am trying to install visual c++ 2013 with bootstrapper, so inside the bundle tag i am using following code to install visual c++ 2013 as follows
<ExePackage Id="VC2013" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q" SourceFile=".\vcredist_x862013.exe" />
currently it will install always, irrespective of whether it is installed or not, how can i put check for whether it is installed or not?
In your bundle, add the following lines:
<util:RegistrySearch Id="VCRedistTest64" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{GUID_HERE}" Result="exists" Variable="VCR64Present" Win64="yes"/>
<util:RegistrySearch Id="VCRedistTest32" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{GUID_HERE}" Result="exists" Variable="VCR32Present" Win64="no"/>
Replace the {GUID_HERE} tags with the correct GUID for Visual C++ 2013. To find this, on a machine with Visual C++ already installer, open your registry and navigate to:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\
In this key there will be several subkeys, where each subkey corresponds to one software package currently installed. Find the key which corresponds to the Visual C++ 2013, and copy the key name, which is the GUID you need to insert into the above code.
Finally, change your Exepackage element to:
<ExePackage Id="VC2013" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q" SourceFile=".\vcredist_x862013.exe" DetectCondition="(VCR32Present OR VCR64Present)/>
This will allow Windows to detect if Visual C++ is already installed, and will prevent your installer from re-installing it.
Also, add the following to the top level "Wix" tag:
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
Recently I had to "pre-select" an feature inside an WiX product. If the target machine is an Terminal-Server, the Feature should be selected for install.
To check, if the machine realy is used as Terminal-Server or not isn't required, since the installing user can still deselect the feature later.
One way to check for Terminal-Server (and not just an machine with RDP enabled) is to use GetVersionEx-API to check the wSuiteMask.
How to check that in WiX?
First we had to link WixUtilExtension.dll (Project-References->Add Reference)
Then use INSTALLLEVEL (as per mrnx's advice) to switch between different Features. We default it to "2" (All below 2 will be selected in feature-selection-screen, all above 2 will be de-selected):
<!--Default Features: All with levl 1-->
<Property Id="INSTALLLEVEL" Value="2" />
Use feature-selection-UI-template (Maybe you have to reference WixUiExtension.dll)
<UI>
<UIRef Id="WixUI_FeatureTree" />
</UI>
Now reference the properties, which we want to know:
<!--Terminal-Server?-->
<PropertyRef Id="WIX_SUITE_TERMINAL" />
<!--On Terminal-Server this property will be null, if multiple RDP-sessions are allowed-->
<PropertyRef Id="WIX_SUITE_SINGLEUSERTS" />
And finally in our Feature-list we have to use the properties inside a condition. The Feature should be de-selected per default, so we set it to one Level higher than the default "2" --> "3".
<Feature Id="TerminalServerServiceFeature" Level="3"
Title="(Feature-Title, i.E.)Terminal-Server-Service"
AllowAdvertise='no'
InstallDefault='local'
Absent='allow'
Description="Some description for the user, when he clicks on the feature" Display="expand"
ConfigurableDirectory='APPLICATIONFOLDER'
>
<!--Reference to the component (or componentgroup) we want to install-->
<ComponentRef Id="TerminalServerServiceComponent" />
<!--This sets this feature to installlevel 1, if the condition evals to true-->
<Condition Level="1">(WIX_SUITE_TERMINAL="1") AND NOT (WIX_SUITE_SINGLEUSERTS)</Condition>
</Feature>
Testing:
To check, why the condition fails, you have to check the installer log (msiexec /i YourMsi.msi /l*v "log.log").
Something along the lines
MSI (c) (8C!98) [11:18:27:663]: PROPERTY CHANGE: Adding
WIX_SUITE_SINGLEUSERTS property. Its value is '1'.
for a machine with RDP but without multi-rdp-session-support and
MSI (c) (4C!E0) [11:26:15:422]: PROPERTY CHANGE: Adding
WIX_SUITE_TERMINAL property. Its value is '1'.
for a machine with RDP and multi-rdp-session-support.
Wix 3.6. I'm trying to run a bundle :
<Bundle Name="Setup" Version="1.0.0.0" Manufacturer="Bentley" UpgradeCode="37d68094-0b98-4b16-bfbe-7f0d3015064a">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<MsiPackage SourceFile="path/to/MyMsiFileWhichIsFine.msi" Cache="yes" Compressed="no" InstallCondition="1"/>
</Chain>
Result from execution :
0x800b0109 A certification chain processed, but terminated in a root certificate which is not trusted by the trust provider.
The log file says :
Detected partially cached package: MyMsiFileWhichIsFine.msi, invalid payload: MyMsiFileWhichIsFine.msi, reason: 0x80070570
I signed this msi. The bootstrapper was also signed using (cf this link):
insignia -ib Setup.exe -o engine.exe
signtool engine.exe (extra parameters excluded for simplicity)
insignia -ab engine.exe Setup.exe -o Setup.exe
signtool Setup.exe
One possibility is the msi was created externally rather than using Heat.exe that comes as part of WIX. I've had similar issues when I was trying to work with VB6 files, and had to add in flags to ignore those checks. But in your case, Bootstrapper might not be able to interpret the msi correctly. How did the msi get created? Did you use Heat? Can you post the Heat lines if so?
I found a solution ! I just skip the signing verification like this :
<ExePackage SourceFile="MyPath\MyFileToLaunch.exe" Compressed="no" SuppressSignatureVerification="yes"/>
Hi I am attempting to create a new boostrapper from my WiX generated MSI. I have done one and it worked but now I need to do another where I check the file version on the file.
According to MSDN I should use the FileCheck element.
<InstallChecks>
<FileCheck Property="VersionDll" FileName="cimwin32.dll" SearchPath="wbem" SpecialFolder="SystemFolder"/>
</InstallChecks>
But it doesn't work for me.
The log generated says:
Running check with folder 'C:\Windows\System32\wbem' and file 'cimwin32.dll'
Attempting to find file 'C:\Windows\System32\wbem\cimwin32.dll'
Could not find file 'cimwin32.dll' in folder 'C:\Windows\System32\wbem'
Not setting value for property 'VersionDll'
Even though the listed path in the log file is correct! Very confusing. Any help would be appreciated
I am not sure if this matters or not but I am seeing this on a 64 Windows 7 OS.
UPDATE
Based off of help from Micheal and some testing this is a problem with File Redirection on 64 bit machines and the FileCheck tag in the bootstrapper. Regardless of architecture I need to check Windows/System32/wbem/cimwin32.dll
Alright. I got it. Thanks to Michael Urman for brainstorming with me. It got me thinking about File Redirection on 64bit OSs that I didn't know happened.
For the bootstrapper to get access to a 32 bit directory on a 64 bit OS it needs to use the alias Sysnative for System32
More info
So I just created another file check. One for 32 and one for 64 and I am up and going.
<InstallChecks>
<FileCheck Property="VersionDll" FileName="cimwin32.dll" SearchPath="System32\wbem" SpecialFolder="WindowsFolder" />
<FileCheck Property="VersionDll64bit" FileName="cimwin32.dll" SearchPath="Sysnative\wbem" SpecialFolder="WindowsFolder" />
</InstallChecks>