.NET 3.5 installation problem in Windows 2012 R2 Server

When you try to enable .NET 3.5 in Windows Server 2012 R2, you might get this error.

Installation of one or more roles, role services, or features failed.
The source files could not be found. Try installing the roles, role services, or features again in a new Add Roles and Features Wizard session, and on the Confirmation page of the wizard, click “Specify an alternate source path” to specify a valid location of the source files that are required for the installation. The location must be accessible by the computer account of the destination server.

This problem occurs because security updates 2966827 and 2966828 for Microsoft Security Bulletin MS14–046 for the .NET Framework 3.5 require metadata that is added to the system only if the Microsoft .NET Framework 3.5 feature is enabled on the system.

Here is a quick fix:

Download the source of Windows 2012 ISO (https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2012-r2)
Mount the ISO and open
Navigate to sources\sxs folder and copy the path (e.g. F:\sources\sxs)
Start .NET installation from Server Manager → Add Features
On the confirmation screen, you will see a warning saying “Do you need to specify an alternate source path….”

Click on “Specify an alternate source path” link in the bottom

Paste the path from Step 3 above

click install. This should resolve the issue.