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 all very simple, however, it cannot be said about the installation of .NET 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 of 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 to the server 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 depository using the Powershell command:
As you can see, the required component is deleted (Install State: Removed)
By default, the system tries to download the necessary files from Windows Update (local WSUS server is not suitable for this purpose), and if this is not possible, the user is prompted 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.
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 line 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 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 looks like this:
Add-WindowsFeature NET-Framework-Core -Source d:\sources\sxs
Path to the «original» Windows distribution can be fixed in the system on an ongoing basis using:
- A registry setting 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 policy changes this setting in the registry)