Home > uncategorized, Windows Server 2012 > Cannot install .NET Framework 3.5 features on Windows Server 2012

Cannot install .NET Framework 3.5 features on Windows Server 2012

Symptom

On a default installation of Windows Server 2012 sometimes you experience problems with the .NET Framework 3.5 features while trying to enable it.

It fails if you try to install it using the Add Roles and Features Wizard, using Powershell or dism.

.NET Framework 3.5 features installation failure

.NET Framework 3.5 features installation failure

The same happens during an SQL Server installation with the following error message:

The following error has occurred:

Error while enabling Windows feature: NetFx3, Error Code: -2146498298, Please try enabling Windows feature: NetFx3 from Windows management tools and then run setup again.

Error while enabling Windows feature: NetFx3

Error while enabling Windows feature: NetFx3

Solution

GUI

On the Add Roles and Features Wizard’s Confirmation page spot the difference: On the top of the page there is an exclamation mark and a short message about missing source files. This simply means that you selected one or more roles and features which files are not available for the operating system at the moment. To amend this select the Sepcify an alternate source path on the bottom of the page.

Missing installation source files

Missing installation source files

On this new window enter the path to your Windows Server 2012 sources/sxs folder. The WIM file won’t work, you need the previously mentioned folder!

Alternate source path

Alternate source path

That’s all using the GUI, sorted.

Powershell

To do the same thing using Powershell type the following command:

Install-WindowsFeature NET-Framework-Core -Source D:\sources\sxs

Where NET-Framework-Core is the feature’s name, and D:\sources\sxs is a folder on the Windows Server 2012 media.

Install .NET Framework 3.5 features using Powershell

Install .NET Framework 3.5 features using Powershell

Command prompt

You can do the same thing from a command prompt, using dism.exe:

dism.exe /online /enable-feature /featurename:netfx3 /all /source:D:\sources\sxs

Online swith simply tells dism to do the task on the running system, the feature’s name with dism is netfx3 (remember the SQL server’s error message? It mentioned the same feature name.) and the last part is the alternate path.

Install .Net Framework 3.5 with dism.exe

Install .Net Framework 3.5 with dism.exe

Explanation

After a few solutions to this problem let!s take a look at the reasons behind this error.

If you open a Powershell window and query the roles and features (Get-WindowsFeature) take a look at .NET Framework 3.5.

Windows roles and features in a Powershell window

Windows roles and features in a Powershell window

In the last column the Install state is different, it says Removed.

  • Available means that you can install the feature and the source files are on the machine and the OS can use them
  • Installed means that the role or feature is already enabled and in use
  • Removed means that you can install the feature but the source files for that are not available for this OS

This is the main difference from any other role or feature and this is the reason the installation fails, the source files are not available. Well, this would not be a problem because Windows can also download them from the Internet! So if you never experienced this but installed this feature or SQL multiple times without any issues, the reason is that your machine simply downloaded the files from the Internet. But in some scenarios this is not possible for various reasons.

By the way you can uninstall any source files like this for any role or feature and it is called Features on demand, read more about this topic here: Roles, features and the WinSxS folder in Windows Server 2012

With features on demand later, most of the time you specify the install.wim file, but this won’t work with .NET Framework 3.5, because by default the sources are not in there. Does not matter if you specify it with the source parameter, copy the files or mount the wim, the files are not there. That’s why any solution recommending this is wrong.

But you can always prepare your own wim file or image with .NET Framework source files already in there, use  dism.exe for this task.

Summary

.NET Framework 3.5 feature installation files are not available by default in a Windows Server 2012 system (neither from the install.wim file)

Windows tries to download the files from the Internet. If you want to avoid it or your server cannot access it specify an alternate source path on the Confirmation page of the wizard or use the source parameter of dism.exe or Install-WindowsFeature powershell commandlet.

The files are not in the install.wim file, but you can create your own with dism for example.

About these ads
  1. johnfail
    March 31, 2013 at 14:34

    I ran into this a few months ago as well. It isn’t too bad to take care of once you realize you need to provide the source, but it’s a headache until you figure that out. This was a very nice write-up of the issue and the solutions available.

  2. Simon
    April 3, 2014 at 16:32

    Found similar responses to this article. I still cannot get the .NetFx3 installed. The feature is shown as Removed as per your article.. The CBS log shows a line stating CBS_E_Download_Failure
    It does not show what file it is trying to download.
    Windows Update is allowed on the server so nothing should be blocking access.

    Do you have a link to a download, I scoured MS site but does not seem to be a version of .NET 3.5 for 2012 R2

    I have a 2012 R2 datacenter install on an Esxi server VM

  3. Simon
    April 16, 2014 at 21:38

    Just an update from me. I found another article and basically the issue i had was the server was using wsus rather than direct to windows update. I had to change a group policy to force the update to MS windows update service. I dont recall the exact setting as not at my PC but it was fairly easy to find googling. The dsim command then worked.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 61 other followers

%d bloggers like this: