Adding Twilio .NET Libraries to your .NET project

The best and easiest way to add the Twilio libraries to your .NET project is to
use the NuGet package manager. NuGet is a Visual Studio extension that makes
it easy to install and update third-party libraries and tools in Visual Studio.

Once you have installed the NuGet extension, you can choose to install the
Twilio libraries using either the Package Manager dialog, or using the Package
Manager console.

Installing via the Package Manager Dialog

To install a Twilio library using the Package Manager dialog, first open the
dialog by right-clicking the References folder in your project and selecting
the package manager option:

When the package manager dialog opens simply search the online catalog for
‘Twilio’. The screen shot below shows the results returned from the NuGet
catalog:

Simply click the Install button next to the Twilio package you want to add to
your project and watch as NuGet downloads the Twilio library package (and its
dependencies) and adds the proper references to your project.

Installing via the Package Manager Console

To install a Twilio library using the Package Manager console, first open the
console, then Use the Install-Package command to install the different Twilio
packages:

Install REST API wrapper:

Install-Package Twilio

Install ASP.NET MVC helpers and REST API wrapper:

Install-Package Twilio.Mvc

Installing in WebMatrix

If you are using Microsoft’s free web developer tool WebMatrix, it also
includes integration with NuGet. To add the Twilio helpers to a site created
using WebMatrix simply open the WebMatrix administration website (as described
here). Change the Show dropdown from Installed to Online and use the search
field to Search for ‘Twilio’.

If the Twilio API returns a 400 or a 500 level HTTP response, objects returned
by the twilio-csharp library will contain a non-null RestException object
with information about the exception. 400-level errors are normal during API
operation ("Invalid number", "Cannot deliver SMS to that number", for
example) and should be checked and handled appropriately.