Microsoft SharePoint is not supported with version 4.0.30319.1 of the Microsoft .Net Runtime
-
28-09-2020 - |
質問
I am developing a windows service in C# and adding dll for SharePoint.
I have added reference from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.dll
The exception is thrown when I do:
using (SPSite objSPSite = new SPSite(_spURL))
{
The url is correct because if I try in powershell, I can connect to it
$web = Get-SPWeb(_spURL)
解決
Please check the Framework version of your project as Sharepoint 2010 is supported for .Net 3.5 A program does need to target the framework 3.5 to use the SharePoint 2010 object model, according to the exception
Also check the following link:
所属していません sharepoint.stackexchange