We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

xrkxs
Posts: 13
Joined: Wed Oct 17, 2007 4:33 pm

Feature with condition installs always

I am trying to avoid installing .NET assemblies in a mergemodule under a feature when the .NET runtime is not installed on the target machine.

I have a made this feature conditional with the following expression: MsiNetAssemblySupport <> ""

Still the assemblies are always installed and the installation failes if .NET is not there.

What am I doing wrong? Is there a way to get this working?

Many thanks,
martein
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

Please check the value of the MsiNetAssemblySupport property like this:
- in the "Custom Actions" page you create a "Script inline" custom action under "InstallExecuteSequence" -> "Install"
- you modify the "Script Text" field to look like this:

Code: Select all

MsgBox Session.Property("MsiNetAssemblySupport")
I have a made this feature conditional with the following expression: MsiNetAssemblySupport <> ""
Please note that you should use this expression for conditioning the feature:

Code: Select all

(Not MsiNetAssemblySupport) AND (Not Installed)
If the MsiNetAssemblySupport property is empty during the install and the feature is still installed then please give more details about how you are using the assemblies and the merge module.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
xrkxs
Posts: 13
Joined: Wed Oct 17, 2007 4:33 pm

Hi Cosmin,

Thanks for your reply. I have tried the inline script and it works as at should. The empty messagebox when .NET is not installed and a messagebox with .NET version string if the runtime is available on the target machine.

It appears to me that the condition I have attached to this feature is not evaluated at all. Whatever I do, the feature is attempted to be installed anyway. If I have "MsiNetAssemblySupport" or "NOT MsiNetAssemblySupport" in the condtion the results are the same.

Below is my project file. I have highlighted the Feature, its condition and the MSM statements for clarity.

I hope you see what is going on.
Many thanks in advance.
Martein

(PS I will be traveling the next couple of weeks, so I might not be able to respond for a little while.)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DOCUMENT type="Advanced Installer" CreateVersion="5.2.2" version="5.2.2" modules="professional" RootPath="..\..\..\..*" Language="en">
<COMPONENT cid="caphyon.advinst.msicomp.MsiPropsComponent">
<ROW Property="AI_MINIEVERCAPTION" Value="6.0"/>
<ROW Property="AI_MINIEVERSION" Value="6.0"/>
<ROW Property="ALLUSERS" Value="2" MultiBuildValue="DefaultBuild:1"/>
<ROW Property="ARPCOMMENTS" Value="This installer database contains the logic and data required to install [|ProductName]." ValueLocId="*"/>
<ROW Property="BannerBitmap" Value="default_banner.bmp" Type="1"/>
<ROW Property="DialogBitmap" Value="default_dialog.bmp" Type="1"/>
<ROW Property="Manufacturer" Value="Bergson Technology B.V." ValueLocId="*"/>
<ROW Property="ProductCode" Value="1033:{07848BCA-C83E-44F8-81F9-571CB050A83B} "/>
<ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="Bergson B&apos;Protected Runtime" ValueLocId="*"/>
<ROW Property="ProductVersion" Value="2.10"/>
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND"/>
<ROW Property="UpgradeCode" Value="{D735C980-A6DB-4E3E-8AF3-7B198023E5D9}"/>
<ROW Property="WIMinVersion" Value="2.0"/>
<ROW Property="WindowsFamily9X" Value="Windows 9x/ME"/>
<ROW Property="WindowsFamilyNT" Value="Windows NT/2k/XP/Vista x86"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiDirsComponent">
<ROW Directory="APPDIR" Directory_Parent="TARGETDIR" DefaultDir="APPDIR:." IsPseudoRoot="1"/>
<ROW Directory="TARGETDIR" DefaultDir="SourceDir"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiCompsComponent">
<ROW Component="Installed" ComponentId="{6C50441D-71B5-42C7-AC4D-158DA6FE7BB1}" Directory_="APPDIR" Attributes="4" KeyPath="Installed" FullKeyPath="HK_UM\Software\Bergson\BProtected\Installed"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiFeatsComponent">
<ROW Feature="DotNetInterop" Feature_Parent="MainFeature" Title="DotNetInterop" Description="Description" Display="3" Level="1" Directory_="APPDIR" Attributes="0"/> <ROW Feature="MainFeature" Title="MainFeature" Description="Description" Display="3" Level="1" Directory_="APPDIR" Attributes="0" Components="Installed"/>
<ATTRIBUTE name="CurrentFeature" value="MainFeature"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.BuildComponent">
<ROW BuildName="DefaultBuild" BuildOrder="1" BuildType="0" InstallationType="4" MsiPackageType="x64"/>
<ATTRIBUTE name="CurrentBuild" value="DefaultBuild"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent">
<ROW Path="<ui.ail>"/>
<ROW Path="<ui_en.ail>"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.FragmentComponent">
<ROW Fragment="FolderDlg.aip" Path="<FolderDlg.aip>"/>
<ROW Fragment="StaticUIStrings.aip" Path="<StaticUIStrings.aip>"/>
<ROW Fragment="UI.aip" Path="<UI.aip>"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiAppSearchComponent">
<ROW Property="AI_IESEARCH" Signature_="AI_IESearchSgn"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiBinaryComponent">
<ROW Name="aicustact.dll" SourcePath="<aicustact.dll>"/>
<ROW Name="default_banner.bmp" SourcePath="<default-banner.bmp>"/>
<ROW Name="default_dialog.bmp" SourcePath="<default-dialog.bmp>"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiConditionComponent">
<ROW Feature_="DotNetInterop" Level="1" Condition="(NOT MsiNetAssemblySupport << "2.0" ) AND (Not Installed)"/> </COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiControlComponent">
<ATTRIBUTE name="FixedSizeBitmaps" value="0"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiControlEventComponent">
<ROW Dialog_="FolderDlg" Control_="Back" Event="NewDialog" Argument="WelcomeDlg" Condition="AI_INSTALL" Ordering="1"/>
<ROW Dialog_="WelcomeDlg" Control_="Next" Event="NewDialog" Argument="FolderDlg" Condition="AI_INSTALL" Ordering="1"/>
<ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="FolderDlg" Condition="AI_INSTALL" Ordering="1"/>
<ROW Dialog_="FolderDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_INSTALL" Ordering="3"/>
<ROW Dialog_="MaintenanceTypeDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceWelcomeDlg" Condition="AI_MAINT" Ordering="1"/>
<ROW Dialog_="MaintenanceWelcomeDlg" Control_="Next" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT" Ordering="2"/>
<ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="PatchWelcomeDlg" Condition="AI_PATCH" Ordering="1"/>
<ROW Dialog_="PatchWelcomeDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_PATCH" Ordering="3"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiCustActComponent">
<ROW Action="AI_DOWNGRADE" Type="19" Target="4010"/>
<ROW Action="AI_PREPARE_UPGRADE" Type="1" Source="aicustact.dll" Target="PrepareUpgrade"/>
<ROW Action="AI_RESTORE_LOCATION" Type="1" Source="aicustact.dll" Target="RestoreLocation"/>
<ROW Action="AI_STORE_LOCATION" Type="51" Source="ARPINSTALLLOCATION" Target="[APPDIR]"/>
<ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]" MultiBuildTarget="DefaultBuild:[ProgramFilesFolder]Bergson\BProtected"/>
<ROW Action="SET_SHORTCUTDIR" Type="307" Source="SHORTCUTDIR" Target="[ProgramMenuFolder][ProductName]"/>
<ROW Action="SET_TARGETDIR_TO_APPDIR" Type="51" Source="TARGETDIR" Target="[APPDIR]"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiDrLocatorComponent">
<ROW Signature_="AI_IESearchSgn" Path="[SystemFolder]" Depth="0"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiInstExSeqComponent">
<ROW Action="AI_DOWNGRADE" Condition="AI_NEWERPRODUCTFOUND AND (UILevel <> 5)" Sequence="210"/>
<ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="740"/>
<ROW Action="AI_STORE_LOCATION" Condition="Not Installed" Sequence="1545"/>
<ROW Action="AI_PREPARE_UPGRADE" Condition="AI_UPGRADE="No" AND (Not Installed)" Sequence="1300"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiInstallUISequenceComponent">
<ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="740"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiLaunchConditionsComponent">
<ROW Condition="AI_IESEARCH" Description="[ProductName] can not be installed on systems with Internet Explorer version smaller than [AI_MINIEVERCAPTION]" DescriptionLocId="AI.LaunchCondition.IE"/>
<ROW Condition="Privileged" Description="[ProductName] requires administrative privileges to install." DescriptionLocId="AI.LaunchCondition.Privileged"/>
<ROW Condition="Version9X OR VersionNT64" Description="[ProductName] can not be installed on [WindowsFamilyNT]"/>
<ROW Condition="VersionMsi>="2.0"" Description="[ProductName] can not be installed on systems with Windows Installer version smaller than [WIMinVersion]"/>
<ROW Condition="VersionNT" Description="[ProductName] can not be installed on [WindowsFamily9X]"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiMergeModsComponent">
<ROW Module="LicenceManagementCore64.msm" Path="Deployment\Installers\Client\Core\LicenceManagementCore64.msm" Feature="MainFeature" Directory="APPDIR"/>
<ROW Module="LicenceManagementInterop64.msm" Path="Deployment\Installers\Client\Interop\LicenceManagementInterop64.msm" Feature="DotNetInterop" Directory="APPDIR"/>
<ROW Module="MSCOMCTL.MSM" Path="C:\Program Files\Common Files\Merge Modules\MSCOMCTL.MSM" Feature="MainFeature" Directory="APPDIR"/>
<ROW Module="MSVBVM60.MSM" Path="C:\Program Files\Common Files\Merge Modules\MSVBVM60.MSM" Feature="MainFeature" Directory="APPDIR"/>
<ROW Module="Microsoft_VC80_CRT_x86.msm" Path="C:\Program Files\Common Files\Merge Modules\Microsoft_VC80_CRT_x86.msm" Feature="DotNetInterop" Directory="APPDIR"/>
<ROW Module="Microsoft_VC80_CRT_x86_x64.msm" Path="C:\Program Files\Common Files\Merge Modules\Microsoft_VC80_CRT_x86_x64.msm" Feature="DotNetInterop" Directory="APPDIR"/>
<ROW Module="policy_8_0_Microsoft_VC80_CRT_x86.msm" Path="C:\Program Files\Common Files\Merge Modules\policy_8_0_Microsoft_VC80_CRT_x86.msm" Feature="DotNetInterop" Directory="APPDIR"/>
<ROW Module="policy_8_0_Microsoft_VC80_CRT_x86_x64.msm" Path="C:\Program Files\Common Files\Merge Modules\policy_8_0_Microsoft_VC80_CRT_x86_x64.msm" Feature="DotNetInterop" Directory="APPDIR"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiRegsComponent">
<ROW Registry="Installed" Root="-1" Key="Software\Bergson\BProtected" Name="Installed" Value="#1" Component_="Installed"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiSignatureComponent">
<ROW Signature="AI_IESearchSgn" FileName="wininet.dll" MinVersion="6.0"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiUpgradeComponent">
<ROW UpgradeCode="[|UpgradeCode]" VersionMax="[|ProductVersion]" Attributes="1025" ActionProperty="OLDPRODUCTS"/>
<ROW UpgradeCode="[|UpgradeCode]" VersionMin="[|ProductVersion]" Attributes="2" ActionProperty="AI_NEWERPRODUCTFOUND"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.PreReqComponent">
<ATTRIBUTE name="MinWIVersion" value="2.0"/>
</COMPONENT>
</DOCUMENT>
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

The feature you have conditioned ("DotNetInterop") does not contain any component (the only component in under the "MainFeature" feature). Since the main feature is not conditioned, the component will always be installed.

I noticed that you are trying to condition the .Net version to be 2.0, the correct condition is this:

Code: Select all

((NOT MsiNetAssemblySupport) OR (Not (MsiNetAssemblySupport << "2.0"))) AND (Not Installed)
Please note that in this case the conditioned feature will be installed only if the .Net Framework version on the target computer is 2.0.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
xrkxs
Posts: 13
Joined: Wed Oct 17, 2007 4:33 pm

Hi Cosmin,

Got it working finally. I am new to MSI...
The condition was functioning, but the associated install level was set to 1. It should be 0....

The condition I use now is:

((Not MsiNetAssemblySupport) OR (MsiNetAssemblySupport << "1") ) AND (Not Installed)

That rejects anyting below .NET 2.

Thanks for your support!
Martein

Return to “Common Problems”