Getting SignalR-Ready in Visual Studio 2010
The recent Microsoft ASP.NET and Web Tools 2012.2 Update made the process of creating SignalR applications much easier within Visual Studio 2012. The update added a series of templates for designing various types of applications, one of which was a very easy to use SignalR template.
However, if you have Visual Studio 2010 and don't feel like jumping to Visual Studio 2012 then that awesome Web Tools Update didn't really apply to you at all. You shouldn't fret, because this post will cover how to get yourself up and running using SignalR within Visual Studio 2010 in a jiffy.
The Problem
You would like to play around with SignalR and all of the incredible things that it can do, but you don't want to download Visual Studio 2012 and use the awesome templates released in the Web Tools 2012.2 Update.
The Solution
There are really only 3 major steps that you'll need to take to get yourself up and running with SignalR and if you keep up with your updates, then you may only need one :
- Visual Studio 2010 Service Pack 1 - This one is a must, and you need it to actually run SignalR.
- NuGet Package Manager - You'll need to set up NuGet within Visual Studio 2010 to download SignalR (and you should want to have it anyways because it is awesome).
- Download SignalR - You can use the previous step to download the latest SignalR package from NuGet (or you can download the appropriate files directly from SignalR).
After getting all of those up and running, you should be ready to dive into the world of SignalR. I'll review over each of the steps individually though, just for the sake of completion.
Downloading Visual Studio 2010 Service Pack 1
As previously mentioned, you'll actually need to download Service Pack 1 to run SignalR. If you are running Visual Studio 2010 anyways you should probably have it for the sake of security, bug fixes and a few additional features :
Setting up NuGet
NuGet is an incredible extension to Visual Studio that allows you to easily download, install, update and manage third-party libraries within your applications. It can save you tons of time and wasted energy searching around for the "right files" and will automatically add the appropriate references to your applications. Within Visual Studio 2010, you can take the following steps to get NuGet up-and-running within your application :
- Click the Tools menu along the menu-bar within Visual Studio 2010.
- Find and Select the Extension Manager option.
- Ensure that the Online Gallery tab is selected on the left-hand side of the dialog.
- Search for "NuGet" in the text box found on the right-hand side.
- Select and Download the NuGet Package Manager extension.
- Restart Visual Studio.
- Celebrate!
or
- Download NuGet from CodePlex here.
- Celebrate with more time left over than the previous steps!
That should be all that you'll need to do to actually install NuGet and even if you don't decide to use it specifically for SignalR, I can promise that you will get plenty of use out of it.
Downloading and Installing SignalR
Now that you actually have NuGet, you can get some use out of it to easily install SignalR into your application through the following steps :
- Right-click on your Project within the Solutions Explorer.
- Select the Manage NuGet Packages option.
- Ensure the Online tab is selected on the left-hand side.
- Search for "SignalR" within the text box on the right.
- Select and Install the Microsoft ASP.NET SignalR package.
Or you can take the scenic route (don't let the fewer steps fool you) :
- Download SignalR from the SignalR site.
- Consider all of the references that you will be adding to your project.
- Go back to the first list and use NuGet to install it (otherwise manually add all the appropriate references to your project)
Voila! You should be good to go to dive into the wonderful real-time world of SignalR.
Actually Getting Started in SignalR
In staying with one of the great phrases of software development "Don't Reinvent the Wheel", I'll provide a link to an excellent and appropriately named tutorial by the folks over at ASP.NET (Tim Teebken and Patrick Fletcher specifically) to get started with SignalR :
and if you want a bit more information about SignalR in general, check these out :