k blog.kenaro.com
← All articles

FileNotFoundException while developing an external SharePoint application

· Ingo Karstein

If you develop a SharePoint Application with Visual Studio 2010, e.g. a Console Aplication, you may get an FileNotFoundException.

For example in this code (program.cs):

namespace DemoConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
           SPSite site = new SPSite("http://sharepoint.local");  //<<--- FileNotFoundException
           SPWeb web = site.RootWeb;
           //your code here

        }
    }
}

I’ve maked the line of code where you may receive the exception.

I solved the problem by setting the platform target in the project settings: Go to “project settings”, select “Build” tab, set “Platform target” setting to the architecture of your platform. I always use “x64” there. – After that the exception is gone.

2 comments

Taipusunpassy Oct 7, 2010
t's such a tickety-boo site. fabulous, very fascinating!!! \------- Opony Pozycjonowanie opony
myjnia kraków Mar 21, 2014
This web site really has all the information and facts I wanted about this subject and didn't know who to ask.

Leave a comment

Your comment is reviewed before it appears. Your name is shown with the comment; your email is required for moderation but never published.