Tuesday, February 4, 2014

The type initializer for 'Microsoft.SharePoint.CoreResource' threw an exception.

Using SharePoint Server 2013;

Error: The type initializer for 'Microsoft.SharePoint.CoreResource' threw an exception.

Scenario: The error was on the line   SPSite site = new SPSite(siteUrl);.
In my VS 2012 project, I was referencing version 14 of Microsoft.SharePoint.dll  and 3.5 as target .net framework version

Resolution: Changed the target framework to 4.0 and referenced the version 15 of Microsoft.SharePoint.dll

The type initializer for 'Microsoft.SharePoint.CoreResource' threw an exception.

No comments:

Post a Comment