Wix Bootstrapper bundle how to specify NOT condition for bal:Condition - wix

What I want to do is:
<bal:Condition Message="Microsoft .NET v4.5.2 is required.">Not (WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED)</bal:Condition>
But it doesn't seem to recognize this syntax. How do I specify NOT in a bal:Condition (and where the heck would this ever be documented?)
Thanks.

So I couldn't figure out how to get that syntax right, nor could I find any decent documentation, anywhere, on this stuff, so I resorted to a registry search:
<util:RegistrySearch
Id="Is452There"
Root="HKLM" Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
Value="Release" Variable="Is452There" Win64="no" />
and then:
<bal:Condition Message="Microsoft .NET v4.5.2 is required.">Is452There>="379893"</bal:Condition>
This seemed to do the trick.

Related

How can I detect whether .NET Framework 3.5 or higher is installed in WiX?

I currently using the following markup in my WiX installer project to check if .NET Framework 3.5 or greater is installed.
there is no Release Reg_DWORD for .Net Framework 3.5 But you can detect it using the following RegistrySearch:
<Property Id="NET35INSTALLED" Secure="yes" Admin="yes"/>
<util:RegistrySearch
Id="Net35Installed"
Variable="NET35INSTALLED"
Root="HKLM"
Key="Software\Microsoft\NET Framework Setup\NDP\v3.5"
Value="Install"
Win64="no"
Format="compatible"
/>
To use it in a condition use NET35INSTALLED = 1.
See more information in the official documentation.
Visit :
https://www.mking.net/blog/detecting-dotnet-framework-versions-with-wix
there you see the check for 4.7.2 installed :
<PropertyRef Id='WIXNETFX4RELEASEINSTALLED'/>
<Condition Message='This setup requires the .NET Framework 4.7.2 (or greater) to be installed.'>
<![CDATA[Installed OR (WIXNETFX4RELEASEINSTALLED >= "#461808")]]>
</Condition>
You only need to replace the release key with the 3.5 version..

RegistrySearch vs util:RegistrySearch in Burn

I am using Burn to build a WiX bootstrapper. I realized that RegistrySearch as shown below does not actually search the registry. I used Process Monitor to monitor registry access.
<Property Id="NETFX35VERSION" Secure="yes">
<RegistrySearch Id="RegSearchNetFx35" Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5"
Name="Version" Type="raw" />
</Property>
However, when I used the util function it was working fine and the registry got queried fine:
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5"
Value="Version"
Variable="NETFX35VERSION" />
Is this expected behavior with the WiX Burn tool?
Property and RegistrySearch are concepts for .msi packages. Bundles (bootstrappers) aren't processed by the MSI engine so they have other concepts, like Variable and util:RegistrySearch. They're similar and generally bundles have more functionality in searches than the MSI equivalent.

Writing in the x64 part of the registry with an otherwise x86 mai pack created in Wix

I'm writing an installer pack for a product using Wix, the whole thing is in x86, but now i need to add a key to the x64 part of the registry. I looked around and found this stack answer which I thought would solve my problem. But I'm getting a ICE80 error (not a warning) which tells me that I basically need to change my Package Platform attribute to x64.
I would however rather avoid that because as I mentioned it's only one registry key that needs to be in x64.
So my question is: Is there another way to resolve the ICE80 error or do I need to build two msi packages, one for x86 and one for x64.
Here is some of my code to further illustrate what I'm trying to do:
<Component Id="Foo" Guid="{GUID}" Win64="yes">
<RegistryKey Root="HKLM" Key="Software\Microsoft\Windows NT\CurrentVersion\Terminal Server\Compatibility\IniFiles">
<RegistryValue Type="integer" Name="Hello" Value="1"/>
</RegistryKey>
<Condition><![CDATA[VersionNT64]]></Condition>
</Component>
<Component Id="Bar" Guid="{GUID}">
<RegistryKey Root="HKLM" Key="Software\Microsoft\Windows NT\CurrentVersion\Terminal Server\Compatibility\IniFiles">
<RegistryValue Type="integer" Name="Hello" Value="1"/>
</RegistryKey>
</Component>
Any help is appreciated!
Windows Installer doesn't support a 32-bit package writing to the 64-bit registry (or file system). A 64-bit package can write to both 32-bit and 64-bit portions.
Perhaps it didn't work then. I am using Wix v10 and in my x86 WIX project, and adding Win64="yes"initially generated ICE80 error. Once I suppressed that warning (in Visual Studio, "Tool Settings" -> "Suppress specific validation:" column), I no longer get that error. When I ran the x86 installer on Windows 2012 R2, those x64 reg keys were created.
Add Win64="yes" to the registry entry you want to put in the 64-bit in the registry..:) I have not included the condition in my own and it works perfectly with just the Win64 attribute.

Running a Custom Action on conditions issue

Can anyone tell me why this is not working please?
I have two registry checks to check if Visual C++ Redistributables are installed:
<Property Id="REGDBKEYEXISTX64">
<RegistrySearch Id="REGDBKEYEXISTX64" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\{837b34e3-7c30-493c-8f6a-2b0f04e2912c}" Name="Version" Type="raw" Win64="yes" />
</Property>
<!--Checking if Microsoft Visual C++ Redistributables are installed on a 32-bit system-->
<Property Id="REGDBKEYEXIST">
<RegistrySearch Id="REGDBKEYEXIST" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\{837b34e3-7c30-493c-8f6a-2b0f04e2912c}" Name="Version" Type="raw" Win64="no" />
</Property>
I then run a custom action if they are not installed:
<Custom Action="InstallRedistributables" After="GetVariantName">Installed OR REGDBKEYEXISTX64 OR REGDBKEYEXIST</Custom>
However when the redistributables are installed it still runs the custom action which is what i do not want. I know it detects it as this is my log file:
Property: REGDBKEYEXIST, Signature: REGDBKEYEXIST
MSI (c) (4C:44) [12:19:04:989]: PROPERTY CHANGE: Adding REGDBKEYEXIST property. Its value is '#134276921'.
So what could be the problem? I have this done on another custom action and it works perfectly so i really don't know the solution.
It appears your condition is reversed. The REGDBKEYEXIST properties will be set if the registry key exists, and thus true when the search indicates the redistributable is present. So what you probably want is more like NOT REGDBKEYEXIST You also probably only want to run this on first time install (hence your reference to Installed). So I would suggest changing your condition to something more like the following:
NOT(Installed or REGDBKEYEXIST or REGDBKEYEXISTX64)

Howto download a dependency with WIX 3.6

I'm using WIX 3.6 Bundle to install an application. It requires some prerequisites. How can I set up the package, so that the bootstrapper automatically download the file from the internet?
I know that WIX setup itself does exactly that. But I can't find the difference. Here's my fragment for the .NET Framework 3.5:
<Fragment>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="Version" Variable="NetFX35Version" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="Version" Variable="NetFX35x64Version" Win64="yes" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="SP" Variable="NetFX35SP" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="SP" Variable="NetFX35x64SP" Win64="yes" />
<PackageGroup Id="NetFX35">
<ExePackage Id="NetFX35" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="$(var.TargetDir)dotnetfx35setup.exe"
DownloadUrl="http://download.microsoft.com/download/0/6/1/061F001C-8752-4600-A198-53214C69B51F/dotnetfx35setup.exe"
DetectCondition="(NetFX35Version AND NetFX35SP >= 1) AND (NOT VersionNT64 OR (NetFX35x64Version AND NetFX35x64SP >= 1))" />
</PackageGroup>
</Fragment>
When I use this fragment and the dotnetfx35setup.exe is not present, the Bootstrapper shows a message box, asking if it should download the file. But it should do that automatically.
UPDATE:
I'm using WixStandardBootstrapperApplication. Does the managed bootstrapper application behave different?
WixStdBA always prompts before downloading. I'd suggest filing a feature request to make it something you can suppress. There isn't currently a managed bootstrapper application; ManagedBootstrapperApplicationHost is the infrastructure to support your own managed-code BA.