Complete WiX sample *.wxs to download and install a specific version of .NET Framework if it's not available

青春壹個敷衍的年華 提交于 2019-12-04 22:11:05

问题


There are many incomplete questions and answers about how to download and install .NET Framework(s) if they are not available but none complete code seems to be available on Internet.

Can you provide a minimal compilable code or a link to a clear example that generates a setup.exe/MSI? I don't think RTFM applies to this question since MSI and bootstrap installers has a lot of idiosyncrasies that are not easily deductible.


回答1:


Note, this information is available in full in the manual. It can be found in the following locations with examples:

How To: Install the .NET Framework Using Burn

How To: Check for .NET Framework versions

WixNetfxExtension

That being said

Using WiX, you cannot generate an MSI to install .Net [X]. You can, however, use it to generate a bootstrapped installer executable.

Luckily, including the .Net installer is trivially simple in a WiX Bundle project. Simply include a reference to the WixNetFxExtension.dll (should be in "[Wix Install location]\bin") in your bundle project, and then include the following in your <Chain>:

<PackageGroupRef id="[.Net package]" />

where [.Net package] is:

  • NetFx40Web
  • NetFx40Redist
  • NetFx40ClientWeb
  • NetFx40ClientRedist
  • NetFx45Web
  • NetFx45Redist

For example, a bundle that includes the .Net 4.5 Web installer:

<Bundle Name="E.G." Version="1.0.0.0" Manufacturer="Me" UpgradeCode="[Guid]">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
    <Chain>
        <PackageGroupRef Id="NetFx45Web" />
        <MsiPackage SourceFile="$(var.ExampleInstaller.TargetPath)" />
    </Chain>
</Bundle>

And if you are using the Redist packages, you can run the compiled installer with -layout to download the files so that they can be burned to a CD/DVD (using the Standard Bootsrapper application, custom bootstrapper applications may or may not have similar functionality).



来源:https://stackoverflow.com/questions/16616430/complete-wix-sample-wxs-to-download-and-install-a-specific-version-of-net-fra

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