In WiX, what's the correct way to enable .NET

2020-04-21 04:23发布

问题:

I'm creating an installer for a Windows desktop app, which has a dependency on another product that requires .NET 3.5

When installing this on Windows 10, .NET 3.5 is included and has to be enabled in Add/Remove Windows Features. I don't think it is valid to install a downloadable version of .NET 3.5 on Windows 10 (correct me if I'm wrong!).

So, is there a way to get WiX to enable the .NET 3.5 "feature" rather than downloading and installing it?

回答1:

Not sure whether this is the correct way but you can try a custom action with the following command

dism.exe /online /enable-feature /featurename:NetFx3

You can get a list of all available features by dism /online /get-features if you want to try other windows features.



回答2:

WiX Samples: Some potentially helpful links in general:

  • WiX Quick Start Suggestions (with sample links).
  • https://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/

Alternative Tools: Maybe keep in mind that commercial tools have features that are easier to use to get your product out there quickly. WiX is great though.

  • MSI Tools (comparing different MSI tools)
  • On WiX, setup GUI and Commercial tools

Prerequisites: I would suggest you add a LaunchCondition to the package to abort installation if the .NET framework is not there. You can bundle the .NET framework with your application, but I really do not recommend that: Outdated prerequisites in packages.

LaunchCondition: The concept of LaunchConditions checks for a certain condition to be true before installation is allowed to continue:

  • Check if prerequisites are installed before installing a windows installer package (please check this link at the very least - if you don't check other links)
  • An earlier answer on LaunchConditions.

Quick, inline sample:

<Condition Message="The .NET Framework 2.0 must be installed">
    Installed OR NETFRAMEWORK20
</Condition>

WiX and .NET Framework: Some built-in measures to detect the .NET framwork.

  • How To: Check for .NET Framework Versions (official WiX documentation)
  • How to check for .net framework 4.7.1 with Wix 3.11
  • How can I detect whether .NET Framework 4.6.1 or higher is installed in WiX?

Link:

  • Wix IIS Version check launch condition not working
  • LaunchConditions and missing runtimes