Tuesday, September 14, 2010

SharePoint 2010 Object Model Development Tips

I learned a couple things today as I tried to create a simple Console Application. By default, the SharePoint project templates have everything preconfigured, but the out of the box defaults used by the Console Application project template will not support this.

1.) Your target framework must be .NET Framework 3.5. You can do this when you create a new project or by updating the following:
Project -> Properties -> Application -> Target framework

2.) Your debug configuration must use x64 as its active solution platform. Otherwise you're going to get a very non-intuitive message like the following:

"Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

You can change this by picking Configuration Manager from the Build menu or from the Solution Configurations drop down menu in your toolbar. Make sure the Active Solution Platform is not x86.