for me it was because of invalid reference to Microsoft.Shareppoint.dllafter migrating to SharePoint 2013 in a console application we used for some automation
just add below address of Microsoft.Shareppoint.dll
Correct
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.dll
you can found this reference to this correct dll , after creating a empty SharePoint 2013 project in your UAT.
I was getting this error inside my Windows 2012 R2 UAT and Visual Studio 2015 Update 1 , when my reference was incorrectly to a dll found in GAC
Incorrect
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint\v4.0_15.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.dll