PSSnapin – Could not load file or assembly or one of its dependencies

Whenever you’re writing aPowerShell SnapIn you may encounter an error when you try to load the PSSnapIn.
Specifically, when the error states:

Add-PSSnapin : Cannot load Windows PowerShell snap-in because of the following error: Could not load file or assembly or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Now this is a nasty little thing to find the cause of so I’ve decided to write this blog post.
The solution for this, at least in my case, was to create a powershell.exe.config file in the PowerShell folder (for x86 ‘%windir%\System32\WindowsPowerShell\V1.0‘ and for x64 ‘%windir%\Syswow64\WindowsPowerShell\V1.0’).
In this file, place the following content: