PDA

View Full Version : Offline installation of .NET 3.5 in Windows 10



eacc3525
07-05-2017, 10:19 AM
Frustrated at the approach Flexera chose to handle the offline installation of .Net 3.5 after Microsoft decided to change the way .NET 3.5 is installed in Windows 8.1 and 10, I decided to share my solution of this issue with the Flexera development community so the individuals can move forward by themselves.

11360

First, you need to understand the tools that will be use to provide a solution for the installation of .NET 3.5 Offline.

1) DISM – Deployment Image Servicing and Management
https://technet.microsoft.com/en-us/library/hh825236.aspx
You will use this utility to enable the .NET 3.5 feature in Windows 8.1 or 10 and to select and online or offline installation.

2) .NET 3.5 Installation cab file from Windows Installation iso.
.iso\sources\sxs\microsoft-windows-netfx3-ondemand-package.cab
You will need the cab file above to install .NET 3.5 Offline

3) Creating an InstallShield Wrapper
https://flexeracommunity.force.com/customer/articles/en_US/HOWTO/Creating-an-InstallScript-Wrapper
This is a great How To article from Flexera.

4) WOW64 Redirection
https://msdn.microsoft.com/en-us/library/windows/desktop/aa384187(v=vs.85).aspx
If you are going to install .NET 3.5 in a 64 bit system, you will need to disable the WOW64 Redirection.

5) InstallShield Prerequisite Editor Reference
http://helpnet.flexerasoftware.com/installshield23helplib/installshield23helplib.htm#helplibrary/SetupPrereqEditor.htm?Highlight=prerequisite
Adding the Offline installation of .NET 3.5 to your product install will be done using a Prerequisite.

Let’s work in the actual solution. This is how to install .NET 3.5 in your Win10 box with no connection to the Internet

Install .NET 3.5 Offline in Windows 10.
1) Copy the netfx3 cab file above to a new empty directory. Let’s call it TempDir.
2) Open a Windows Command Processor and change directory to your TempDir above.
3) Execute:

Dism /online /enable-feature /featurename:NetFx3 /All /Source:TempDir /LimitAccess

4) If it goes all the way to 100% in few seconds, you have .NET 3.5 already installed. If you see the percent completion increment 2 to 3 percent per second you are installing .NET 3.5 Offline.

First step toward the installation of .NET 3.5 using InstallShield. Lets run the same command above from a batch file.

1) You will need a bat file to execute the DISM command. Save this file in TempDir. See the batch commands below:

@echo off
echo .NET 3.5 installation...
Rem This script allow the offline installation of the Microsoft .Net 3.5 on Windows 10
Rem The argument to the batch file will be the full path of the directory where the cab file lives.
set TempDir=%1

Dism /online /enable-feature /featurename:NetFx3 /All /Source:%TempDir% /LimitAccess

exit % errorlevel %

2) if .NET 3.5 is already enable, disable .NET 3.5 by going to “Windows Features” in Control Panel. Deselect the .NET 3.5
3) Now run your bat file adding the absolute path of the TempDir where you have the netfx3 cab file.

Create a wrapper for your installation. Now lets start working with InstallShield to provide a solution for your installations.

1) Create a wrapper using the instructions from Flexera in
https://flexeracommunity.force.com/customer/articles/en_US/HOWTO/Creating-an-InstallScript-Wrapper
2) Use the TempDir to create your wrapper.
3) At the step when the instruction ask you to “Add custom code in the OnFirstUIBefore event…”, add the code in the attach file below:

11359

4) The statement “Disable(WOW64FSREDIRECTION);” is only needed in 64 bit system. If you are running a 32 bit version of Windows 10, delete this line and make sure the PROGRAM define have the correct path to the Windows Command Processor.
5) Make sure that your Release configuration of the wrapper had selected the option “Create a single file executable.
6) Take the exe installation file from the Package directory and test it the same way you tested the bat file above. No argument needed for this executable.

Final step for the Installation. Create a Prerequisite that you can add to your installations.

1) Prepare a prerequisite using the exe file produce above.
2) Move the prerequisite and the executable create above to your InstallShield version SetupPrerequisite. For 2016 version is:
C:\Program Files (x86)\InstallShield\2016\SetupPrerequisites
3) Use the prerequisite in the InstallShield project that required the Offline installation of .NET 3.5

You are done. Congratulation!!!