wix: unable to detect servicepacks - wix

I am trying to detect .net framework 2.0 service pack 2. But it seems that wix is unable to detect that.
below is the script that i am using.
NAnt:
<exec program="${wix.dir}\light.exe" workingdir=".\wix" commandline="-ext WixUIExtension -ext WixNetFxExtension -cultures:en-us SampleFirst.wixobj -out ${release.dir}\NantTest.msi"/>
wix:
<PropertyRef Id="NETFRAMEWORK20"/>
<Condition Message="This application requires .NET Framework 3.5 SP1. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR (NETFRAMEWORK20_SP_LEVEL and NOT NETFRAMEWORK20_SP_LEVEL = "#2")]]>
</Condition>
It is able to detect the ,net framework. But it is not detecting service packs. Any suggestion?

Just use
<PropertyRef Id="NETFRAMEWORK20_SP_LEVEL"/>
instead of
<PropertyRef Id="NETFRAMEWORK20"/>

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..

How to check for .net framework 4.7.1 with Wix 3.11

I am trying to check for .net Version with Wix 3.11 via Condition. This works fine until 4.5 like this:
<PropertyRef Id="NETFRAMEWORK45" />
<Condition Message="This application requires .NET Framework 4.5. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
Checking for anything above 4.5 seems not to be possible - at least not with this mechanism. How can I do that?
That method (PropertyRef) is syntactical sugar. The NetFxExtension preprocessor injects the implementation at compile time. WiX is currently lagging behind. The implementation you are looking for would be something like:
<PropertyRef Id="NETFRAMEWORK45" />
<Condition Message="This application requires .NET Framework 4.7.1. Please install the .NET Framework then run this installer again."><![CDATA[Installed OR NETFRAMEWORK45>=#461308]]>
</Condition>
https://github.com/wixtoolset/issues/issues/5575
Update (hot33331): Added a # before the number 461308. Without that it did not work for me.

"MsiNTProductType", "POWERSHELLVERSION" in WIX 3.6

In my WIX project, I want to use Cited Properties.
The following Cited Properties work well
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message="You must install .Net Framework 4.5">
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
<PropertyRef Id="VersionNT64"/>
<Condition Message="This application cannot be running on 32 bit architechure">
<![CDATA[Installed OR VersionNT64]]>
</Condition>
But other Properties use my debug to filed with the following message:
"Error 1 Unresolved reference to symbol 'Property:MsiNTProductType' in section 'Product:*'"
for example:
BTW, the WixNetFxExtension exist.
MsiNTProductType is a valid built-in Windows Installer property, so this should work OK provided you haven't got any typos in the WIX code. As Phil asks, please update your question with the actual Wix code that references the MsiNTProductType property.
In my experience it is easy to mix up something trivial in a Wix source file, and the error is most likely just an extra comma, dot or some other trivial typo. I'll just include a link to the MSI Property Reference.
This is my properties section.
The only one that work is "NETFRAMEWORK45".
The rest of them in comment because they cuse the error I mention.
I must understand why the error occured.
Thanks,
Didi
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message="You must install .Net Framework 4.5">
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
<!--
<PropertyRef Id="POWERSHELLVERSION"/>
<Condition Message="You must install Powershell ver 3.0">
<![CDATA[Installed OR POWERSHELLVERSION >= "3.0"]]>
</Condition>
<PropertyRef Id="VersionNT64"/>
<Condition Message="This application cannot be running on 32 bit architechure">
<![CDATA[Installed OR VersionNT64]]>
</Condition>
<PropertyRef Id ="VersionNT"/>
<Condition Message="Operating system must be Windows Server 2008 or higher">
<![CDATA[VersionNT >= 600]]>
</Condition>
<PropertyRef Id ="MsiNTProductType"/>
<Condition Message="Operating system must be SERVER O.S">
<![CDATA[MsiNTProductType <> 3]]>
</Condition>
-->
MsiNTProductType is a standard Windows Installer property - you're trying to redefine it and getting that error. All you need for the standard properties is the condition - delete the PropertyRef for MsiNTProductType, VersionNT, VersionNT64.

WiX bootstrapper disable .NET Framework installation chaining

In my WiX installer, I do not want .NET installed automatically if it isn't installed. It should just give a warning or merely error out.
The reason to avoid it is explained here:
One HUGE word of
caution here: Because the .Net installer will technically be part of
your install chain, if the user installs .Net but then cancels your
install, your installer will still be listed in the Add/Remove
programs since one if it’s components (the .Net installer) completed.
Tread with caution.
He seems to be intentionally including it. But I'm not and I happened to set <supportedRuntime version="v4.5" /> which I guess isn't a real version (4.5 => 4.0 as far as this is concerned?). My WiX managed bootstrapper application exe automatically prompted me to download and install the "missing" .NET Framework.
For computers that ARE missing 4.0, I don't want this to happen. WiX also complains if I leave out:
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="..." />
<WixVariable Id="WixMbaPrereqPackageId" Value="..." />
in which I literally leave in ... because I don't want it to work anyway.
In this thread, #Shruthi asks
Is there a way to replace the prerequisite .Net install UI with just an notification to the user that they need to install a particular version of .Net before they can install the bundle?
And Rob Mensching replies:
Yes, that is possible now.
... BUT HE DOESN'T ELABORATE. How is it possible now?
Thanks!
===============
In my Bundle's Bootstrap.Config:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v6" /> <!-- Pretending it's the future! -->
</startup>
The Bundle itself does not reference any .NET stuff and does not reference WixNetFxExtension and uses the custom <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" />
To answer how to handle checking for the .Net 4.0 Framework include the WixNetfxExtension in your project
then under product add a reference to the property NETFRAMEWORK40FULL and put a condition on it.
<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>
for the chained case again include wixnetfxextension and include NetFx40Redist package group
<PackageGroupRef Id="NetFx40Redist"/>

How can I check .NET framework 4.5 prerequestics in WiX

I'd like to validate both .NET framework 4.0 and 4.5 should be installed at server before proceeding a installation. Hence I used the following snippet, but I don't know about 4.5 validattion, which was not listed in the link Reference
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Condition Message='This setup requires Microsoft .NET Framework 4.0 Full package or greater needs to be installed for this installation to continue.'>
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
The NETFRAMEWORK45 property can be used the same as the NETFRAMEWORK40FULL. Note there is no "client" or "full" framework for The .NET Framework v4.5. There is just one. So the following code should do what you want:
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message='This setup requires Microsoft .NET Framework 4.0 Full package or greater needs to be installed for this installation to continue.'>
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
<Condition Message='This setup requires Microsoft .NET Framework 4.5 package or greater needs to be installed for this installation to continue.'>
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
Note that .NET Framework v4.5 is an in place upgrade of .NET Framework 4.0 so checking for both could get you into a situation where you'll never satisfy both conditions. You might want to just check that .NET Framework v4.0 or .NET Framework v4.5 is installed. That condition would look more like:
<Condition Message='This setup requires Microsoft .NET Framework 4.0 Full or 4.5 package or greater needs to be installed for this installation to continue.'>
<![CDATA[Installed OR NETFRAMEWORK40FULL OR NETFRAMEWORK45]]>
</Condition>