Last updated: Jan-03-2023
This quick start is intended to let you quickly try using several common Cloudinary features. It doesn't necessarily employ coding best practices and the code you create here isn't intended for production.
You can perform this quick start in a code sandbox or in a clean project in the dev environment of your choice.
You can also view the completed code of this quick start in a GitHub repo.
You may also find our Glossary helpful to understand Cloudinary-specific terminology.
To perform the steps in this quick start, you'll need:
- A Cloudinary account. If you don't have one yet, you can quickly register for free.
- Your product environment credentials. You can find your credentials in the Dashboard page of your Cloudinary Console.
- A working .NET development environment with a supported version of .NET.
- A clean .NET console project or .NET fiddle.
1. Set up and configure the library
Add CloudinaryDotNet and dotenv.net using the Nuget Package Manager or if using the Package Manager Console, run:
Then, in your project, create a file called
.env and add the following line with your Cloudinary environment variable:
In your code, include the following
CloudinaryDotNet libraries as well as the
dotenv.net library in your project.
You can then load your Cloudinary credentials from your .env file as shown below. Copy and paste the following code into your
2. Upload an image
Copy and paste the following code into your Program.cs file:
3. Get details of the image
4. Transform the uploaded image
5. Run your code
Run your code by clicking the Run button in Visual Studio or .NET fiddle.
You can use the returned image tag to display the image on your website. For now, copy and paste the URL to see the transformed image in the browser:
View the completed code
You can find the full code example for this on GitHub.
- Learn more about the .NET SDK by visiting the other pages in this SDK guide.
- Get comprehensive details about Cloudinary features and capabilities:
- Media upload guide: Provides details and examples of the upload options.
- Image transformations guide: Provides details and examples of the transformations you can apply to image assets.
- Video transformations guide: Provides details and examples of the transformations you can apply to video assets.
- Transformation URL API Reference: Provides details and examples of all available transformation parameters.
- Admin API guide: Provides details and examples of the methods available for managing and organizing your media assets.