On Microsoft's newer operating systems, (I encountered this on Windows Server 2016) the .NET Framework 3.5 is a Feature on Demand. The binaries for it aren't included in an installation, but they are present on the iso.
The commonly recommended way of installing it is to use the "Add Role and Features" tool. A step that's also usually mentioned is to pay heed to the warning on the confirmation tab and to click:
Specify an alternative source path
This might fix your problem, but for me it still requires the iso. I didn't have the iso, this was a VM granted to me by IT and asking them to install it would have taken too long.
When you try installing it without providing a valid image you might encounter one of these errors:
0x800f081f – The source files could not be found.
If you don't have an iso.
0x800F0906 - The source files could not be downloaded.
If your organization uses WSUS to manage updates.
0x800F0907 - DISM failed. No operation was performed.
If group policy blocked the installation.
I had some leftover TiWorker.exe processes pinning my cpu. They may have been up to something but I couldn't tell.Kill then in the task manager
I also stopped any WindowsInstaller or TrustedInstaller type processes.
Since we killed those things, let's do some clean-up to avoid leaving the system in a weird state. Open up powershell as admin and run the following:
DISM /online /cleanup-image /restorehealth
You can also run the Windows Update Troubleshooter
Your organization might use WSUS to manage updates. Mine does, and I'm not sure why that matters, but the update wasn't working.
- Open up the policy editor. Hit the windows key and start typing Edit group policy.
- Expand to the right spot. Local Computer Policy -> Computer Configuration -> Administrative Templates -> System
- Select Specify settings for optional component installation and component repair
- Select Enabled, and click the checkbox Download repair content and optional features directly from Windows Update instead of Windows Server Update Services (WSUS)
From an elevated powershell windows, run the following:
DISM /online /enable-feature /featurename:NetFX3 /all
Here's an explanation from the source:
The elimination of the source switch is done on purpose as this will force the server to look within its own SxS folder, not find the needed files, and then go to Windows Update for the files.
Go back and undo the changes made in step 2.