I was trying to develop a functionality to upload a video on facebook, To achieve this, you have to include Facebook NuGet Package in your project.
The question was for me ? What's NuGet ? What's the concept of a Package ? Is it different than VS 2010 Extensions ? and how to add this to my project?
After reading few blogs and experiment this by myself, I wrote this blog post to clarify these points to any developer who hear these terms for the first time as it was for me.
What's NuGet ?
It is a VS 2010 Extension to manage third party and open source libraries in your VS 2010 project, it simplifies the process of installing/uninstalling packages in your projects without worrying about the dependencies dlls and associated files to each packages and so after uninstalling any of these packages on your project there is no clutter.
How to install it NuGet Package Manager:
Once you install this, Please restart your VS 2010.
Once you re-open your VS 2010, You will notice new menu items under tools called: Library Package Manager.
This is how you can install/uninstall packages in your solution with command line window called "Package Manager Console".
In my case, I was trying to install Facebook Sample Package in my project, How would i do that ?
Here is the steps that you need to follow:
1) Open your VS 2o1o as administrator, if you didn't do that, you might get an error when connecting to your TFS as i got Access denied.
2) Open your project and set the startup project you would like to add Facebook samples package to it. It is recommended if this is the first time, Open a new empty project and try these steps so you know exactly the added files when you install any package.
3) To explore NuGet Gallery Packages, here is the website:
For Facebook Package, here is the command you should type it in "Package manager Console":
PM> install-package facebook.sample
Now the facebook sample package has been installed successfully and you can see this in the package manager console.
Open your solution and you will find Samples Folder has been added and Facebook folder underneath it.
You can explore the code and use any of these functions in your project since all dlls and files required have been added to you.
To upload a video to facebook, Check LegacyRestApi.CS in your project and you will find a function called "Upload Video".
Enjoy and have fun with Facebook C# Development.
Let me know if you have any questions following these steps.
If you have FacebookBatchParameter is missing in your solution, please update your Facebook SDK dlls to be above 5.0.8 version. since the batch processing is supported starting from this 5.0.8 and if you have any old dlls doesn't include these classes and features.
Hope this tip helps.
Post a Comment