Menu

Expand
Rate this page:

Twilio NuGet Package Installation

The Twilio C#/.NET SDK makes it easy to interact with the Twilio API from your .NET application. The most recent version of the library can be found on NuGet. The Twilio C# SDK supports .NET applications written in C#, VB.Net, and F# that utilize the .NET Framework version 3.5 or higher or any .NET runtime supporting .NET Standard v1.4. If you are interested in migrating to the newer 6.x version of the Twilio C# SDK, check out this guide.

Install with NuGet

With Visual Studio IDE

From within Visual Studio, you can use the NuGet GUI to search for and install the Twilio NuGet package. Or, as a shortcut, type the following command into the Package Manager Console:

Install-Package Twilio

With .NET Core command line tools

If you are building with the .NET Core command line tools, then you can run the following command from within your project directory:

dotnet add package Twilio

Test your installation

Try sending yourself an SMS message, like this:

        
        
        

        Send an SMS using the Programmable SMS API

        We also have an example in VB.NET and an example in F# if you use one of those languages.

        If you are using the .NET Framework version 4.5.1 or higher or .NET Core 1.0 or higher, you can also make API calls asynchronously:

              
              
              
              Send an SMS message asynchronously to test your helper library installation.

              C#/.NET Helper Library Async Example

              Send an SMS message asynchronously to test your helper library installation.

              How to use this library

              Authenticate client

                    
                    
                    

                    Authenticate C# Twilio client

                    Handle errors

                          
                          
                          

                          Handle exceptions in C# helper library

                          Create a new record

                                
                                
                                

                                Make an outbound call

                                Get an existing record

                                      
                                      
                                      

                                      Fetch Call

                                      Iterate through records

                                            
                                            
                                            

                                            Read Call

                                            The library automatically handles paging for you. With the Read method, you can specify the number of records you want to receive (limit) and the maximum size you want each page fetch to be (pageSize). The library will then handle the task for you, fetching new pages under the hood as you iterate over the records.

                                            For more information, view the auto-generated library docs.

                                            DateTime values

                                            All DateTime values in the C# helper library are in your local timezone (Kind=Local). Learn more details here on how to convert this to UTC or set UTC as your default.

                                            More documentation

                                            Once you're up and running with the C# SDK, you'll find code samples using the latest version in our REST API docs and in the documentation for every Twilio product. You can also find auto-generated library docs for the latest SDK here.

                                            Access the 5.x version of the SDK

                                            The older version of the C# Twilio SDK will continue to work, and you will continue to find sample code for this version throughout our documentation. Should you need to install this version with NuGet, you can do so with the following command:

                                            Install-Package Twilio -Version 5.81.1

                                            Get help

                                            We'd love to hear your feedback on the C# SDK, and help you past any issues you may encounter. Feel free to drop us a line, and we'll make sure to get you sorted!

                                            Rate this page:

                                            Need some help?

                                            We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                            Thank you for your feedback!

                                            Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                            Sending your feedback...
                                            🎉 Thank you for your feedback!
                                            Something went wrong. Please try again.

                                            Thanks for your feedback!

                                            thanks-feedback-gif