SharePoint 2010: could not resolve type in class library

Today I was working on one of my first SP2010 projects. I started off with creating a class library which would host some classes providing logic which interacted with the new SharePoint 2010 object model. I also created a console application to test the methods as defined in the class library.

When I tried to build, the types of the classes in the class library could not be resolved in the console application project. That was weird, because I had added the correct references and Intellisence seemed to pick that up.

Visual Studio 2010 has multiple target frameworks for .NET Framework 4.0. One of them is the full framework, the other one is a client subset. The console application was set to the client framework by default, but the SharePoint class library needed the full one. So that messed up the build and therefore the type couldn’t be resolved. Changing the target framework to the full 4.0 framework for the console application fixed the error!

Leave a Reply

Your email address will not be published. Required fields are marked *