Programmable Media

.NET quick start

Last updated: Jun-04-2024

This quick start lets you get an end-to-end implementation up and running using the .NET SDK in 5 minutes or less.

1. Set up and configure the library

Using a clean .NET console project or .NET fiddle, 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:

.env

Important
When writing your own applications, follow your organization's policy on storing secrets and don't expose your API secret.

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 Program.cs file:

Program.cs

2. Upload an image

Copy and paste the following code into your Program.cs file:

Program.cs (continued)

3. Get details of the image

Program.cs (continued)

4. Transform the uploaded image

Program.cs (continued)

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:

Transformed cld-sample image

View the completed code

You can find the full code example for this on GitHub.

Next steps

  • Learn more about the .NET SDK by visiting the other pages in this SDK guide.
  • Get comprehensive details about Cloudinary features and capabilities:

✔️ Feedback sent!

Rate this page: