I click Add Reference, and add FacebookAPI.dll. Everything seems to work, i don’t get any errors while writing the code, and code completion works fine.
Then, when i try to build it, it gives me an error saying it can’t find the Facebook namespace, the reference is still in the reference list, but it’s like i haven’t added it anymore.
It works with the example included when you download the API.
I’m using visual studio 2010.
It’s not clear what kind of app you’re writing, but have you got “Copy Local” set to “False” on the reference properties by any chance? If so, change it to “True”. Otherwise the DLL won’t be copied to the output location, which is where it’s required when you run the app.
EDIT: Okay, now we’ve got a sample solution, the problem is clear – you’ve either got the wrong project type or you’re using the wrong DLL. The target framework in your project is “.NET Framework 4 Client Profile” but you’re building against the version of FacebookAPI.dll which depends on the full .NET 4 framework. This would have been obvious if you’d also told us that you’d got warnings like this (copied from trying to build it myself):
The solution is to either use the version of FacebookAPI.dll which is built for .NET 4 client profile, or to change the target framework version to just “.NET 4 Framework”.