Facebook C# SDK v5 Beta Internals

A new major beta version for the Facebook C# SDK v5.0 is up in codeplex. If you haven’t tired it out, grab a copy of it at http://facebooksdk.codeplex.com/releases/view/60281 and we would love to hear your feedback.

In this blog post I will be explaining about some of the changes we brought in v5. Some of them are breaking changes especially in terms of the authentication process. We hope these necessary changes will ease your Facebook development.

Here are some major changes that you would see in v5.

  • Client Only Profile:

Prior to v5, there were 2 different builds of Facebook.dll for the desktop platforms. One was built under client profile which would be used for desktop apps while the other under full profile for Web Applications. To make it consistent across different profiles the core Facebook.dll is now distributed only under client profile. Starting from v5, this is the same library you would use whether you are creating a desktop app or a web app.

  • Authentication:

Much of this release has been focused on making the authentication easier. There has been a major rewrite particularly on this part where we have simplified and made the authentication process similar across different platforms whether you are creating a web app or a silverlight app or even a windows phone app. All authentication has been migrated to use the new Facebook OAuth dialog. Over the next few days I will be blogging about the authentication process used in different platforms. The core classes used for authentication are – FacebookOAuthClient, FacebookOAuthResult, Authorizer and CanvasAuthorizer.

  • Unified Facebook Application Settings:

With the introduction of a new interface IFacebookApplication we have unified the Facebook Application Settings in v5. The application settings and canvas settings have been merged. Another thing to notice is that some of the properties has been renamed to mimic the original Facebook Application Settings as you would see in your facebook application settings (http://www.facebook.com/developers/apps.php?app_id=xxxxx)

<facebookSettings
  appId = "{app id}"
  appSecret = "{app secret}" 
  canvasPage = "http://apps.facebook.com/app/"
  canvasUrl ="http://localhost/" />
  • Programmatically setting the Facebook Application Settings:

Don’t like web.config. No problem. It just got better. There is now an alternative way to easily to set the Facebook Application settings if you would rather prefer to do it via code by calling FacebookContext.SetApplication( IFacebookApplication ). This is especially a bonus for those who would like to set the Facebook Application Settings via looking up at the database. (Will be doing another blog post on how to retrieve Facebook Application settings using database in the upcoming days.)

Besides these new features there has also been a number of bug fixes in v5 along with more number of unit tests.

As this is a beta release we would love to hear your feedback on the new v5. If you would like to hear updates on the SDK make sure you join the Facebook C# SDK official page at http://www.facebook.com/csharpsdk. Over the days I will be doing a series of blog post on using the new Facebook C# SDK v5. If you would like to see any particular tutorial please feel free to write it down in the comments. Till then grab yourself a copy of the Facebook C# SDK from codeplex.

(Note: If you are developing Facebook web application or silverlight web applications we highly recommend you to use IIS even for development purposes rather than the inbuilt Visual Studio Cassini Web Server.)

[v 5.0.1 UPDATES]

Staring from v5.0.1 Beta we have renamed FacebookApp to FacebookClient and FacebookAppBase to FacebookClientBase. You can fix this change by either just doing a find or replace or by setting the following using statement:

using FacebookApp = Facebook.FacebookClient;
using FacebookAppBase = Facebook.FacebookClientBase;