“Object reference not set to an instance of an object” when calling SPFarm.Local

If you are getting “Object reference not set to an instance of an object” when calling SPFarm.Local in a stand-alone app (e.g. console app), and you are developing against SharePoint 2010, then check that your project is set to target x64 or Any CPU. Setting it to target x86 (which is the default in VS 2010) will give you that error.

Advertisements

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in SharePoint 2010. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s