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

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.

Related

How do I detect .Net Framework 4.7.2 using wix 3.11 burn

I have been trying out to have .net Framework 4.7.2 as a prerequisite for my installer.
I have done below in the bundle file
= $(var.NetFx46MinRelease)]]>
But with these changes I am unable to detect the Framework.
The installer proceeds for installation even it does not have 4.7.2 or higher.
I want the bootstrapper to detect and not the Msi.
Did anyone face the same issue and resolved it?
Check the below links
https://github.com/wixtoolset/issues/issues/5575
Install .NET Framework 4.7.2 (if needed) with WIX installer

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

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

WiX installer - how can I check for .net framework 3.5 and 4.6 with Wix 3.10

I have a requirement to permit a WiX installer to install the product only if Framework 4.6 is installed. If this is not the case I display an error message to the user.
This is working fine, but now I must verify that if there is a previous version running in framework 3.5, I must let the user know that Framework 4.6 is required. Somehow my approach is not working. Would appreciate a little help. This is the code I am using in WiX:
<PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED" />
<Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED]]>
</Condition>
<PropertyRef Id="NETFRAMEWORK35" />
<Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
<![CDATA[(NETFRAMEWORK35 AND NOT WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED)]]>
</Condition>
And in the CustomAction.config I have:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727"/>
</startup>
UPDATE
Changed the Launch Condition to:
<Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
<![CDATA[(Installed OR (NETFRAMEWORK35 = "#1" AND WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED))]]>
</Condition>
But all the installer does is just display the familiar "Setup Wizard ended prematurely"
There may be something I don't understand about your scenario, but wouldn't the first condition cater for both cases? All you need is for .NET 4.6 to be installed? That second condition now appears to be true only when 3.5 is installed and 4.6 is not installed. So I assume the setup won't launch if both versions are installed - and I am not sure if those versions can co-exist? I can never keep track of what .NET versions can be installed at the same time, and what CLR they share. The 3.5 version came with Windows 7 I think? Some details.
I don't see any custom action WiX markup in your question, so I can't really say anything about that CustomAction.config. Managed code custom actions are not my specialty.
Your both launch conditions are countering one another.
One is allowing installation if .Net framework 4.6 or higher is found.
Other is allowing installation only if .Net Framework 3.5 is found and .Net Framework 4.6 is not found.
Your second condition does not have "Installed OR" property, which makes sure uninstall does not fail because of Launch Condition.
Custom Action Config only affects custom action project, your launch conditions are not affected by it .
Edit: Unless your Launch Condition is using some property created by user defined custom action.

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.

how can i attach the framework in WIX

i want to attach .net framework 2.0 file in wix.how can i?so whenever client want to install the msi then it will install the framework directly.so how can i bind the framework in msi package?
reply me soon
Thanking You
Samir
This is covered in a WIX documentation topic: How To: Install the .NET Framework Using a Bootstrapper