You first might think to check your path or something like that, but this is actually caused by a completely different issue. As you know by now, SharePoint 2010 is a 64 bit application. However, when you create a new Console Application, it does not default to x64, it defaults to x86 as shown below.

View your project properties, go to the Build tab and change the platform target to x64. Run your console application again and everything should work as expected now.

It worth checking any other type of external application you might build. Just make sure it is set to x64.

Advertisements