"MsiNTProductType", "POWERSHELLVERSION" in WIX 3.6 - wix

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.

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

Can I move common install conditions to a shared WiX Installer project

I have multiple WiX installer projects in my solution. And all of the installers in the main wxs file under the Product element have the same list of launch conditions, such as privileges, OS version on the target machine, whether NET48 framework is installed or not, etc.
<Condition Message="You need to be an administrator to install this product.">
Privileged
</Condition>
<Condition Message='This product is designed to be installed on Windows 7 or higher Windows Operating System'>
<![CDATA[VersionNT64 >= 601]]>
</Condition>
<PropertyRef Id='WIXNETFX4RELEASEINSTALLED'/>
<Condition Message='This setup requires the .NET Framework 4.8 to be installed.'>
<![CDATA[Installed OR (WIXNETFX4RELEASEINSTALLED >= "#528040")]]>
</Condition>
So I was wondering if it is possible to have these conditions moved into a shared common project in my solution that I can refer to that project from all my installer projects and inject the conditions from that shared place?
If you are only sharing those Launch Conditions then consider using an include file. The conditions will be compiled separately for each project, rather than once, but then you can include them easily without needing to create a shared wixlib.
<?xml version="1.0" encoding="UTF-8"?>
<!-- LaunchConditions.wxi -->
<Include>
<Condition Message="You need to be an administrator to install this product.">
Privileged
</Condition>
<Condition Message='This product is designed to be installed on Windows 7 or higher Windows Operating System'>
<![CDATA[VersionNT64 >= 601]]>
</Condition>
<PropertyRef Id='WIXNETFX4RELEASEINSTALLED'/>
<Condition Message='This setup requires the .NET Framework 4.8 to be installed.'>
<![CDATA[Installed OR (WIXNETFX4RELEASEINSTALLED >= "#528040")]]>
</Condition>
</Include>
then in each project include it with
<?include LaunchConditions.wxi?>
WiX doesn't have a ConditionRef element. It's a shame cause it probably should. However fragements are consumed atomically so if you put them in with something else like a Property you could ref the property and get it all together.
I don't know how clean you want your Condition table but another concept is just put all your conditions in one fragement and share them with all your projects. Then for each condition you an enabling property. This way the condition only evaluates if the property is set.
Here's something I wrote 16 years ago.... I'd be happy to assist if you want to do something like this.
http://blog.iswix.com/2006/07/short-comings-of-launchconditions.html

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.

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>

wix: unable to detect servicepacks

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"/>