Something which I don’t think I covered before but if I have, it bears repeating. I’m updating the chapter I wrote for the SQL Server 2008 upgrade guide for SQL Server 2008 R2, and finally got around to documenting how to properly install .NET Framework 3.51 on Windows Server 2008 R2 so you can install SQL Server 2008 or SQL Server 2008 R2. This blog post will cover how to install it using a command prompt and Part Two will cover the GUI, and you’ll see why the command line are PowerShell ways are better and less confusing. These instructions will also help you create deployment scripts, which will help you automate the entire process.

You should not need to reboot to install .NET 3.51 under normal conditions.

Note: The instructions assume the user executing have the right permissions to install features.

Why are things different on Windows Server 2008 R2? If you try to run the standalone installer package that ships with SQL Server 2008 or SQL Server 2008 R2, you will see this message:

Error when trying to install .NET using the package

It’s not the best written message as the tool it tells you to use is wrong, but that’s OK. Don’t worry about that. You’ll see what I mean in Part Two.

Normal Command Prompt
The first method I’m going to show you on how to install .NET Framework 3.51 is using the dism command, which can be done in any Command Prompt window. The command you want to enter is:

dism.exe /online /enable-feature /featurename:NetFx3

Below is a sample execution:

Installing .NET 3.51 using dism

If you’re wondering why I got the reboot prompt, it’s probably because I had just done the PowerShell way (see below) and didn’t reboot yet.

PowerShell
If you haven’t hear me say it before, I’ll say it again: learn PowerShell. It’s the way of the future for command line-based administration and tools. You’ll be using two cmdlets: Get-WindowsFeature and Add-WindowsFeature.

First, you will execute the command:
Get-WindowsFeature NET*

This will show you the status of whether or note what you want is installed. Note that in the sample execution below, there is no X next to any of the .NET-related features. Now, also note that there are multiple options for .NET features. For SQL Server, you only need the .NET Framework. As you will see in Part Two, if you try to install everything, you’ll get things you may not want nor should you install in most SQL Server installs (especially on a cluster).

Once you verify that .NET 3.51 has not been configured, you will execute this command:
Add-WindowsFeature Net-Framework-Core
Note that the Net-Framework-Core is the name Windows uses internally; don’t try to use the friendly name (the Display Name column) from the output of Get-WindowsFeature. Use the value from the Name column.

Finally, re-run Get-WindowsFeature NET* and you will see everything is configured.

Below is a sample execution:

Installing .NET 3.51 Using PowerShell