I was having this exception when I was trying to run either the Update-SPSolution or the Enable-SPFeature
We all know that sharepoint only supports .net 3.5
The problem that I was having here is that I was using a tool PowerGUI to run the powershell scripts.
Apparently this tool has a bug.
After I ran the commands in the normal powershell window, I didnt have this exception anymore
So to fix it:
Since this is a PowerGUI issue, you can fix it by following this solution. Follow these steps.
- Open your windows explorer and navigate to C:\Program Files (x86)\PowerGUI\ and open the configuration file ScriptEditor.exe.config.
- Change the supportedRuntime version under Startup settings by removing the version=”v4.0″ as below
<startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v2.0.50727" /> </startup>
No you can enjoy the powerful editor again.