Se in una console application per
SharePoint 2010 (Foundation - Server) in cui viene istanziando un oggetto
SPSite compare il seguente errore:
FileNotFoundException was unhandledThe Web application
http://spfarm/spdoclib
could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
molto probabilmente il progetto è compilato per una piattaforma a 32 bit (x86).
Dato che
SharePoint 2010 funziona solo su macchine a 64 bit, vai in
Visual Studio 2010 nelle
properties del progetto nella scheda
Build e modifica la voce
Platform taget in
x64 per compilare il progetto a 64 bit.
Assicurati anche che il progetto sia impostato per lavorare con il
Framework 3.5.