How can I create a bootstrapper that auto-installs .Net Framework 4.5

你。 提交于 2019-12-02 03:36:15

You will need to do following in your bootstrapper "bundle.wxs"
1. ref NetFxExtension.dll, which can be found in Wix SDK folder
2. Create Util to look if the user has .net45 or not
3. Net 4.5 Download link

I worked on similar thing for one of my projects and below is my bundle.wxs for your reference

<?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
         xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
         xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
         xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
    <Bundle Name="XXX" 
            Copyright="XXXXX" 
            Manufacturer="XXXXX" 
            Version="0.0.0.0" 
            UpgradeCode="XXXXXX_XXXX" IconSourceFile="..\XXX.ico" >

<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
  <bal:WixManagedBootstrapperApplicationHost LicenseUrl="NetfxLicense.rtf"   
        LogoFile="Images\Microsoft-.NET-4.5-Icon.ico"/>
  <Payload SourceFile="C:\Program Files (x86)\WiX Toolset v3.8\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
</BootstrapperApplicationRef>

<WixVariable Id="WixMbaPrereqPackageId" Value="NetFx45WebPackageGroup" />   
 </Bundle>

<Fragment>

   <bal:Condition Message="Please select &quot;Accept and Install&quot; to Install it">Not   Netfx4x64FullVersion</bal:Condition>


  <PackageGroup Id="NetFx45WebPackageGroup">
    <ExePackage Id="NetFx45WebPackageGroup"                      
                Cache="no" 
                Compressed="yes" 
                PerMachine="yes" 
                Permanent="yes" 
                Vital="yes" SourceFile="$(var.Bin)\dotNetFx45_Full_setup.exe" InstallCommand="/q"
    DownloadUrl="http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_setup.exe"
    DetectCondition="(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))"
    />
 </PackageGroup>
</Fragment> 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!