2

I want a bootstrapper to install .NET 4.5 (if not available) before installing my setup.msi. If the machine has .NET 4.5 then I want to install the product setup.msi only.

Following is my code:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

    <Bundle Name="AAA" Version="1.0.0.0"  UpgradeCode="8DA460D6-B4CB-4ED0-A1FE-44F269070647">
        <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
        </BootstrapperApplicationRef>

        <Chain>
            <PackageGroupRef Id="Netfx45FullP"/>

            <MsiPackage Compressed="yes" Vital="yes"  Id="PMService" Cache="yes" Visible="no"
                SourceFile="C:\Users\abc.msi">
            </MsiPackage>
        </Chain>
    </Bundle>

    <Fragment>
        <WixVariable Id="WixMbaPrereqPackageId" Value="Netfx45Full" />
        <WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />

        <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4FullVersion" />
        <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4x64FullVersion" Win64="yes" />

        <PackageGroup Id="Netfx45FullP">
            <ExePackage Id="Netfx45" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
                        InstallCommand="/q"
                        SourceFile="dotNetFx45_Full_x86_x64.exe"
                        DetectCondition="(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))"
                        InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;))"/>
        </PackageGroup>
    </Fragment>
</Wix>

1 Answer 1

2

You'll want to remove the AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;) part of your install condition.

The detect condition will handle the case of telling if the .NET Framework is installed. If it is detected as installed, it will not be installed again.

The install condition will determine if the package should be allowed to be on the machine or not. If it evaluates to false the package will be uninstalled from the machine.

By adding the detect condition to the install condition your basically making it never true that the package can be installed on the machine and stay on the machine. :)

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your reply Rob Mensching I want the detect condition because my requirement is...if .net framework is not installed in the machine,my bootstrapper want to install the .net frmaework and then install the product. If the machine already have .net framework then...it just want to install product setup..I'm little bit confuce..Can u clear that point? And still it is not working properly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.