Install .net Framework 3.5 on Windows Server 2008R2 - Advanced Installer Community
abstuerzer
Posts: 11
Joined: Thu Apr 29, 2010 10:07 am

Install .net Framework 3.5 on Windows Server 2008R2

Microsoft changed the installation of .net Framework 3.5 SP1 on Windows Server 2008 R2. The framework could only be installed with "Add Windows features" in Server Manager.

My Problem is actually that my setup packet must work on Windows Server 2003 and 2008 and 2008 R2. I have the framework 3.5SP1 in my prerequisites. When trying to install on 2008R2, I get an error form the OS, which says to install with the Server manager.

How can I prevent my setup from installing .net framework 3.5SP1 on a Windows Server 2008 R2 and give me a messagebox with instructions.

Thx for helping
Chris
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Install .net Framework 3.5 on Windows Server 2008R2

Hi Chris,

You will need to do a few things:
1) create a search from your Prerequisite Install Conditions Tab to detect the 2008R2 version of Windows so that the prerequisite will not be installed. Our user manual explains the usage of searches for prerequisites.
2) create a search from the Search page in Advanced Installer and search the registry for .net framework
3) create another search from the Search page to detect the Windows' build number (this is to identify windows 2008 and differentiate between it and R2)
4) create an Error Message custom action that is conditioned to be triggered when the operating system is Windows Server 2008 R2 (use the property from the previous step) and .net is missing (use the property from step 2)

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
abstuerzer
Posts: 11
Joined: Thu Apr 29, 2010 10:07 am

Re: Install .net Framework 3.5 on Windows Server 2008R2

It does not work. I checked it in many ways.

I do a search for Registry Key exists
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5

And I use this property called NET35INSTALLED in Custom Action to dipplay an error message
Here is the execution condition ( (VersionNT >= 601) AND ( NET35INSTALLED <> 1 ) )

But I always get the error message, even the registry Key exists.

Please help me again
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Install .net Framework 3.5 on Windows Server 2008R2

Hello,

Please send your .aip project file to support at advancedinstaller dot com so we can investigate the issue.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Install .net Framework 3.5 on Windows Server 2008R2

Hi,

You can try this approach:
- make sure that your .NET Framework 3.5 prerequisite doesn't support Windows Server 2008 R2
- create a Launch File or Open URL Using a 64-bit Launcher custom action under InstallExecuteSequence -> Install
- make sure that it uses Synchronous execution, ignore return code option
- schedule it as Deferred with no impersonation
- in Custom Action Properties pane set Command Line field to:

Code: Select all

[System64Folder]ServerManagerCmd.exe -install NET-Framework -restart
- condition this custom action to run only on Windows Server 2008 R2

This way your prerequisite is skipped on Windows Server 2008 R2 and .NET Framework is installed as a feature.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Rok R
Posts: 1
Joined: Fri Oct 28, 2011 8:24 am

Re: Install .net Framework 3.5 on Windows Server 2008R2

Hi,

Since Cosmin's solution opens the command prompt window during installation, I am providing the solution for hidden install of framework as a feature.

1. If you install framework 3.5 under prerequisites, select edit on the prerequisite and under 64 bit Windows untick Server 2008R2 (Install Conditions -> Launch conditions)

2. In Search add New Extended Search and name it

Code: Select all

NETFRAMWORK3.5
As a Criteria select Registry Key exists and add registry key

Code: Select all

HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5
3. In Custom actions under Install add a New Custom Action -> Script Inline. Source Type should be set to Visual basic script and Script text should contain the following code:

Code: Select all

const WindowStyleStealth  = &H20000000 : set WSO = createobject("WScript.Shell") : WSO.run "%comspec% /c ServerManagerCmd.exe -install NET-Framework-Core", WindowStyleStealth, true
Select 64 - bit script, run in Synchronous execution, check return code with Deferred with no impersonation option selected. Under Execution condition enter the following

Code: Select all

NOT Installed AND VersionNT64  AND ( VersionNT = "601" ) AND (NOT NETFRAMWORK3.5)
As a final note, this only installs core framework features. To install complete framework, replace this

Code: Select all

ServerManagerCmd.exe -install NET-Framework-Core
in Script text, with the following

Code: Select all

ServerManagerCmd.exe -install NET-Framework
I would also like to thank Cosmin for his support, so that I could come to this solution!

Best Regards,

Rok
nasowasauch
Posts: 3
Joined: Tue Jun 25, 2013 12:39 pm

Re: Install .net Framework 3.5 on Windows Server 2008R2

Hi,

in my case I needed another solution, because the .net framework 3.5 was mandatory as a prerequisite for MS SQL Server 2008 which was a feature based prerequisite itself. This means .net 3.5 had to be installed beforehand. So I created a C# console application with Visual Studio in .net 2.0 and x64 (important!). Here is the code:

Code: Select all

using System;
using System.Diagnostics;

namespace InstallNET35Server2008
{
    class Program
    {
        static void Main(string[] args)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();
            startInfo.FileName = "powershell.exe";
            startInfo.Arguments = "-ImportSystemModules  Add-WindowsFeature net-framework";
            startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            startInfo.UseShellExecute = false;
            Process p = new Process();
            p.StartInfo = startInfo;
            p.Start();
            p.WaitForExit();
        }
    }
}
This executable can be added as a Pre-install Prerequisite. Like the other suggestions uncheck the normal .net framework 3.5 installation for Win Server 2008 / 2012 and use the executable on these OS instead. As Install Condition check if the registry key exists:

Code: Select all

HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5
Of course, a command-line window appears. But at least it shows a progress bar. I hope that this post helps people who have the same requirements as me.

EDIT: Since Advanced Installer 10.2 there is the possibility to enable Windows features in the Prerequisites. But in my case the .net framework 3.5 is still missing if SQL Server 2008 R2 should be installed as a prerequisite itself. The feature configuration comes too late. And I cannot postpone the installation of SQL Server 2008 to Post-install because I need to execute a script on the just installed database.

But for people who do not need the framework 3.5 already during installation process it would be more convenient to let the Windows features be configured by Advanced Installer.

Greetings
Last edited by nasowasauch on Tue Jul 16, 2013 7:50 am, edited 5 times in total.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Install .net Framework 3.5 on Windows Server 2008R2

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

Thank you for sharing this with us. I'm sure this will help future users in the same situation.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”