1

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?

Tim Long
  • 13,508
  • 19
  • 79
  • 147
  • In all honesty, the *correct* way is **to not install it**. As we have been told by MS .NET 4.x should be backward compatible. You should avoid it like the plague. Also, there are now developer versions (> 3.14) of *wixtoolset* that does a registry hack to avoid users to have to install that old legacy *"malware"*. – not2qubit Nov 02 '20 at 12:23

3 Answers3

2

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.

lastr2d2
  • 3,604
  • 2
  • 22
  • 37
  • You might be able to invoke this from a `setup.exe` bundle? Be aware that this might be frowned upon to do without asking the user - but I guess that will ask the user? – Stein Åsmul Aug 01 '19 at 13:52
  • I've also had this fail a lot and then people call in saying they can't install even if you put an informative message about it being a Microsoft/OS issue. Because it happened in *your* installer, it's your problem. Typically for dism stuff I like to just have the user do it themselves and fail the install with a launch condition until they do it. – Brian Sutherland Aug 01 '19 at 16:48
  • @SteinÅsmul I would use another setup msi to wrap that custom action, or use ``directly. sth like`` -- not tested though – lastr2d2 Aug 02 '19 at 03:11
1

There is a way to install .NET 3.5 on Windows 10 and the latest Windows Server: to update a group policy value that will allow to download .NET 3.5 (blog post).

...open the command prompt and type "gpedit". The "Local Computer Policy Editor" opens where we can locate the necessary setting under the "Computer Configuration" > "Administrative Templates" > "System". On the left side, under "Settings", we can find a setting named "Specify settings for optional component installation and component repair" policy list This is what we are going to modify. Let's open it and check "Enabled" and then check the second option – "Download repair content and optional features directly from Windows Update instead of Windows Server Update Services (WSUS)" and click "OK": policy settings Now, if we retry adding the .NET Framework 3.5, we can see that it succeeds...

I personally then revert this policy setting to its original value, if it was different.

Burst
  • 689
  • 7
  • 15
0

WiX Samples: Some potentially helpful links in general:


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.


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:

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.


Link:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164