\
Windows Installer FAQ (the basics)
Properties
Specific Properties
MsiNetAssemblySupport
This property will contain the highest level of the dot net framework
available on the system or will not be defined if no .net framework is
installed.
Because this property is not perfect
(for example you can't tell if a specific framework is installed)
and that
it can fail
you should also see the ".NET Framework Installed?" section.
Please see Microsoft's online documentation for the "MsiNetAssemblySupport" property
(or "MSI.CHM") for more information.
My Attempt to test for .NET 3.5 |
A "custom action" would be better at processing the property but this is my attempt at
a pure windows Installer solution:
;--- Some constants ----
#define MSG_MIN_.NET_VER 3.5
#define MSG_HOW_TO_GET_.NET Please download from Microsoft's site and install it before installing media companion.
#define MSG_NO_.NET [ProductName] needs at least the <$MSG_MIN_.NET_VER> version of the .NET framwork but you don't have any installed. <$MSG_HOW_TO_GET_.NET>
#define MSG_OLDER_.NET [ProductName] needs at least the <$MSG_MIN_.NET_VER> version of the .NET framwork but you only have [MsiNetAssemblySupport] installed. <$MSG_HOW_TO_GET_.NET>
;--- Check for non-existance of any and then versions we don't want ----
#define Highest.NetVerShouldntStartWith \ ;;Note that "MsiNetAssemblySupport" contains the HIGHEST framework version
<$AbortIf Message="<$MSG_OLDER_.NET>" CONDITION=^(<$CONDITION_INSTALL_ONLY>) and MsiNetAssemblySupport and MsiNetAssemblySupport << "{$#1}."^>
<$AbortIf Message="<$MSG_NO_.NET>" CONDITION=^(<$CONDITION_INSTALL_ONLY>) and not MsiNetAssemblySupport^>
<$Highest.NetVerShouldntStartWith "1">
;<$Highest.NetVerShouldntStartWith "2"> ;;Can't do see: http://makemsi-manual.dennisbareis.com/msinetassemblysupport_property_can_contain_the_wrong_value.htm
;<$Highest.NetVerShouldntStartWith "3.0"> ;;Same Issue
As Windows Installer
unexpectedly returned a "2.0..." value instead of a "3.5.." one
we couldn't abort if the property started with "2." or "3.0." so the example only
aborts if the highest framework reported is "1." or no framework is detected.