Most modern Windows applications require .NET Framework to work properly. The roles and features setup wizard Server Manager in Windows Server 2012 R2 allows to install two different versions of .NET Framework at a time – 3.5 and 4.5. The installation of .NET Framework 4.5 doesn’t usually cause any problems – it’s very simple, however, you can’t say exactly the same about the installation of .NET Framework 3.5.
Actually, when trying to install .NET Framework 3.5 in Windows Server 2012 R2 with the standard settings, the following error message appears: «Installation of one of more roles, role services or features failed. The source files could not be found…».
The reason behind this behavior is that .NET Framework 3.5 binary files are not a part of the local cache of the binary files that are saved on the server’s system disk when the operating system is being installed. This is done under the concept of Features on Demand in Windows Server 2012 to reduce the amount of disk space occupied by the OS for its own needs.
Check if .NET Framework 3.5 is in the local repository using the Powershell command:
As you can see, the required component is deleted (Install State: Removed).
By default, when you install NET Framework 3.5 through Server Manager, the system tries to obtain the necessary files from the Windows Update website over the Internet (not from the local WSUS server), and if the server does not have Internet access, the installation fails. The user needs to specify the path to the OS distribution from which the missing component could be installed.
To install .NET Framework 3.5 manually, click Specify an alternative source path to enter an alternative path to a folder containing the installation disk of Windows Server 2012 R2.
Tip. The installation disk must contain the same version of OS that you have installed (the same edition, language, and updates are important). If the installer does not find the required files in the specified folder, see the solution below.
As the path, you can specify either a local folder (in our example it is D:\source\sxs, where D:\ is a letter of the local DVD drive with a Windows Server distribution), or a network folder.
By clicking OK, the system will find .NET Framework 3.5 binaries and install the component.
The same operation can be performed from the command prompt by running the following command as an administrator:
dism /online /enable-feature /featurename:NetFX3 /all /Source:d:\sources\sxs /LimitAccess
/Online means that you need to upgrade your current OS, and not the wim image
/enable-feature/featurename: NetFX3/all means that it is necessary to install .NET Framework 3.5 with all its features
/Source is the path to the directory with Windows distribution, which contains the necessary components
/LimitAccess prevents accessing Windows Update
The same operation in PowerShell for installing .Net 3.5 looks like this:
Add-WindowsFeature NET-Framework-Core -Source d:\sources\sxs
Path to the original Windows distribution can be set in the system on a regular basis using:
- the registry parameter RepairContentServerSource that is located in the HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Servicing branch
- or a group policy Specify settings for optional component installation and component repair (the policychanges this setting in the registry)
Note. The group policy Specify settings for optional component installation and component repair is in the following section GPO: Computer Configuration -> Administrative Templates -> System. The policy should be enabled and the path to the directory with the OS distribution should be specified (Alternative source file path). To prevent the server from trying to update online, check the box Never attempt to download payload from Windows Update.
To verify that the .NET Framework 3.5 is installed, go to the C:\Windows\Microsoft.NET\Framework64 directory and make sure that v3.5 folder appeared.
If the .NET Framework 3.5.1 installation methods described above did not help you, try the following solutions.
After installing some updates, the version (build) of Windows Server 2012 R2 in the system may cease to correspond to the image of the OS stored in your distribution image. In this case, the installer, when comparing the version of the Windows kernel, refuses to install the deprecated version of the component. In this case, as a rule, when you install the .NET Framework through dism, the following error occurs: 0x800f081f. The source files could not be found
To fix the problem try to install .Net online through from Microsoft servers:
- Save the current Windows Update settings to the reg file (key HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate)
- Delete this key and restart the WU service:
net stop wuauserv & net start wuauserv
- Run the .Net5 online installation:
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All
- After the installation is complete, return the WU settings by importing the reg file and restart the WindowsUpdate service again
Tip. In the future, you can use folder C:\Windows\winsxs from this server to install .Net FrameWork 3.5 on other servers with the same version of the OS. Copy the C:\Windows\winsxs folder to the desired server in the C:\tmp\winsxs directory and install the component with the command:
dism /online /enable-feature /featurename:NetFX3 /all /Source:C:\tmp\winsxs /LimitAccess
In addition, if you installed a Language Packs on the server, before you install the .NET Framework 3.5.1, you must uninstall it using the lpksetup command.
Also check that there are installed patches for NET 3.5 Framework in the list of installed system updates (in theory they should not have been installed if the NetFX3 component is not installed).
Uninstall this updates and after the reboot, try installing .NET 3.5.