In WiX, what's the correct way to enable .NET 3.5? - wix

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?

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.

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"
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":
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.

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

Related

Wix Installer won't build on buildserver

I have tried to build a Wix MSI using our build server. I have set the build configuration in the Configuration manager to DEBUG/x86. All the other projects build correctly EXCEPT for the Wix Installer.
Initially there was an error requesting the latest version of WIX was installed on the build server "The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" so I follwed this -
https://subscription.packtpub.com/book/web_development/9781784393212/1/ch01lvl1sec12/compiling-a-wix-installer-on-a-build-machine-using-msbuild
also have used this -
https://wixtoolset.org/documentation/manual/v3/msbuild/wix_with_team_build.html
Now the build freezes on the Wix project and eventually times oout at 59 minutes. What would be wrong? what needs correctling?
I have tried these suggestions already - https://subscription.packtpub.com/book/web_development/9781784393212/1/ch01lvl1sec12/compiling-a-wix-installer-on-a-build-machine-using-msbuild
also have used this -
https://wixtoolset.org/documentation/manual/v3/msbuild/wix_with_team_build.html
Expecting it to build, then I can create an MSI file.
.NET 3.5: This might very well be something else, but maybe try to install the .NET Framework 3.5. WiX 3.x has a build-dependency requiring this .NET version.
How-To: Please see this answer for more details: WiX Toolset: Creating a simple WiX project breaks in VS2017: The "CreateProjectReferenceDefineConstants" task was not found

How to download and install the .NET Framework using Wix Installer?

We have an Application that depends on an installed .NET Framework 4.5. The Wix setup should automatically detect when an .NET Framework 4.5 (or greater) is not installed. That works fine with the following wix declaration:
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message=".NET Framwork 4.5 is not installed.">
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
Our Target: The Wix Setup should automatically download and install the .Net Framework 4.5. It seem, that 'burn' provides a mechanism, that let the setup install the .NET Framwork automatically: http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_dotnet.html. The documentation defines references to Setup files of the .NET Framework:
<MsiPackage Id="MyApplication" SourceFile="$(var.MyApplicationSetup.TargetPath)"/>
But we not want to add the .NET Framework into our Setup. The setup should automatically download it on the target system where the setup will be executed.
How can we achieve this?
Please see the NetFx45Web package group ref:
http://wixtoolset.org/documentation/manual/v3/customactions/wixnetfxextension.html
For more information on how this works if you didn't have the package group ref see a similar example:
Web download of vcruntime140 with wix burn
Microsoft allows you to redistribute their framework but only in its original form.
This also means that you can't build the framework into your own .msi package.
What you can do is to provide a separate bootstrap installer, Setup.exe, that looks for the installed framework and starts your .NET Framework redistributable.
If you have found a way to do this without using a Bootstrap installer, please let me know.

WixManagedBootstrapperApplicationHost custom UI

I have created a msi which allows user to view license, select installation folder, and features to install. That all works well.
Now I need to create a bootstrapper that will check if framework 4.5 is installed, install it if not, and then install msi.
I can do this using WixStandardBootstrapperApplication.RtfLargeLicense, where I would install framework, and then execute msi with its own UI.
But what if I do not want to show two apps (msi over exe), but only one window?
Since my msi contains feature, standard bootstrapper does not provide interface where I can set features from msi, so I need to create a custom UI.
The problem is I do not quite understand how WixManagedBootstrapperApplicationHost works? I created a dll with new UI, and place it in Payload. When running the setup, when framework needs to be installed, WixManagedBootstrapperApplicationHost always invokes its own window which says:
Microsoft .NET Framework required for MyApp Setup. Click the "Accept and Install" button to accept the Microsoft .NET Framework license terms.
And after it completes installation of .NET Framework, then it invokes the UI that I Created in dll. Why would anyone want this kind of functionality, where my bootstrapper app contains totally different UI than the framework installation UI? Isn't the idea of bootstrapper with custom UI is to provide completely custom UI?
So, how can I provide my custom UI for that framework installation part?
I assume your own UI is C# and WPF? If your installing it on a machine without .Net then it's going to need to install .Net before it can show the WPF UI. I could be wrong but I'm sure that's unavoidable.
If you want to replace / modify the .Net install screen then this thread looks like it has the answer:
Wix Burn: Basic UI handling if No Net Framework is there
However if your saying the .Net install dialog is showing up over your UI at some point in installation then you need to set the Install command to "/q" which means quiet (no UI).

VS2012 and Wix 3.6 - Installing .Net 4.5 with my application

I am very new to the installer world.
I have successfully made an .msi for my application and it is building with short-cuts and also uninstalls correctly.
My next goal is to package .Net 4.5 with the installer and have it be installed prior to the installation of my application.
I also have a third party application that needs to be installed. It is packaged as an msi.
From what I can gather I need to develop a Bootstraper solution to have these applications install in sequence.
Can anyone provide a guide as to how to implement an installer in such a way? My searches have come up with a bunch of partial implementations with an assumption of the design of a Wix Bootstrapper Project in Visual Studio.
I hope this helps someone. It took me 5 hours to figure it out. Maybe, my bad, but did not find anything about it in the docs or blogs.
So my scenario is: VS 2012, WIX 3.6 with Burn bootsrapper, create a Setup executable in order to check .NET Framework 4.5 and install it by downloading if not installed already. Sounds simple. And it is. Actually very.
Create your MSI installer project (WIX Setup Project), to produce an installer for your application.
Create a WIX Bootstrapper Project for your Setup executable.
Follow the instructions here, to create your Boundle.wxs
Add a reference to the WixNetFxExtension.dll which can be found in the WIX program directory.
Include the following line in your Chain:
<PackageGroupRef Id="NetFx45Redist"/>
Actually the WixNetFx extension contains a working install package definition for the .NET Framework 4.5.
As caveman_dick mentioned, Burn in WiX 3.6 supports this but you may also want to take a look at dotNetInstaller (http://dblock.github.com/dotnetinstaller/). We use it to install .NET 4.0 but I'm sure it works for installing 4.5 as well. It can also install other MSI dependencies very easily.

WIX: GenerateBootStrapper conditions?

I've built an installer with WIX and have packaged it with the .NET 4.0 framework using the GenerateBootstrapper task. Now .NET 4.0 cannot be installed on XP SP2, but it appears to have no precondition check for this so its installer fails halfway through.
I'd like to add my own check to make sure the OS that the entire package is being installed on is supported by the .NET 4.0 framework. Is there a way to embed an OS/Service Pack check in the bootstrapper when you use GenerateBootstrapper? If not, how else can I accomplish this?
You could add a condition to the bootstrapper package definition file so that the bootstrapper will check for the Windows version. The description file is located at
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\
Packages\DotNetFX40\Product.xml
on a 64-bit Windows system or at
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\
Packages\DotNetFX40\Product.xml
on a 32-bit Windows system. The package.xml already contains such a check, see the line
<!-- Block install on less than Windows XP SP2 -->
<FailIf Property="VersionNT" Compare="VersionLessThan"
Value="5.1.2" String="InvalidPlatformWinNT" />
I couldn't find the relevant documentation, but it looks as if the third number of the VersionNT value is the service pack level, so probably changing the condition to check for a value of "5.1.3" will do the job.