Errors when writing applications for SharePoint 2010

So, you’ve opened Visual Studio 2010, say, for instance, a console application to start pecking away at writing some simple application via the API. Nothing major, maybe in fact you are just re-using code from 2007 you’ve written, but, you just want to play with the API, after you’ve finished drooling over the new UI. Great! So, you’ve written your code, you press F5 to debug run your program, and [insert failure sound from The Price is Right here] – you get an error. The error makes no sense? FileNotFoundException? You’re using the IW image from Microsoft. You know for a fact the site exists – its open in your browser on your other monitor?! And more importantly, you know this code words. You’ve muttered it out from your fingertips hundreds of times (or, have it pasted in through a code snippet – why re-invent the SPRequest object reference wheel?)


No need to worry – after you’ve no doubt put your hand through your nice looking but poorly made substitute-for-a-punching-bag IKEA Imon desk (its ok, they’re made that way so you don’t injure yourself! A few layers of wood putty will fix it up even better than before. Now your desk looks more “arty”. You’re hip now!), it is a simple fix. A console application by default in VS 2010 sets the platform target as x86. Not x64, not Any CPU, but x86. Which will NOT work with the 64-bit only SharePoint 2010. Set this back to Any CPU, or x64 if needed, and hit F5 again.


Now your cookin’ with gas! Simple, eh? A quick helpful hint – the Community Kit for SharePoint: Development Tools (CKS:DEV) project contains a project type called “SharePoint Console Application”, which sets all of this up for you, right off the bat.


About Geoff Varosky
Geoff Varosky is a Senior Architect for Insight, based out of Watertown, MA. He has been architecting and developing web based applications his entire career, and has been working with SharePoint for the past 15 years. Geoff is an active member of the SharePoint community, Co-Founder and Co-Organizer of the Boston Area SharePoint Users Group, co-founder for the Boston Office 365 Users Group, co-organizer for SharePoint Saturday Boston and speaks regularly at SharePoint events and user groups.

Leave a Reply

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

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

Facebook photo

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

Connecting to %s

%d bloggers like this: