We are excited to introduce the Microsoft .NET SDK! This new addition to our SDK family makes it easier for customers and partners to create compelling apps and websites powered by Contentstack with speed and agility. Before the introduction of our Microsoft .NET SDK, developers would have had to write an API wrapper around Contentstack’s extensive library of RESTful Content Delivery APIs. Using this SDK, Contentstack’s customers and partners who are performing deployments in .NET can accelerate their time to market.
.NET is a framework developed by Microsoft that runs primarily on Microsoft Windows. It contains an extensive class library called Framework Class Library and it provides programming language interoperability across many languages.
Using the new .NET SDK, you will be able to create .NET apps that will fetch content from Contentstack and deliver it to your applications. The SDK uses our Content Delivery APIs and has several inbuilt methods so that you don’t have to reinvent the wheel.
Getting started with .NET SDK
To use the .NET SDK, you will need to install the SDK and then initialize it. You can then execute queries for your app.
Step 1 - SDK Installation and Setup
To use the .NET SDK, perform the steps given below:
- Open the terminal and install the contentstack module via ‘Package Manager’ command as follows:
PM> Install-Package contentstack.csharp
Or, you can do this via ‘.Net CLI’ as follows:
dotnet add package contentstack.csharp
- Add Namespace to your class
using Contentstack.Core; // ContentstackClient using Contentstack.Core.Models; // Stack, Query, Entry, Asset, ContentType using Contentstack.Core.Configuration; // ContentstackOptions
Step 2 - Initialize SDK
Specify the API key, Access token, and Environment Name of your stack to initialize the SDK:
// Initialize the Contentstack ContentstackClient stack = new ContentstackClient("api_key", "access_token", "environment_name");
OR
var options = new ContentstackOptions() { ApiKey = "<api_key>", AccessToken = "<access_token>" Environment = "<environment>" } ContentstackClient stack = new ContentstackClient(options);
Once you have installed and initialized the .NET SDK, you can start getting content in your app.
Start working with your app
Try out basic queries to deliver content to your .NET apps. We have created in-depth documentation on how to get started with this SDK. You can find more details in our .NET SDK guide.
With the addition of .NET SDK, we hope to enhance your developer experience. Users can leverage the full power of the .NET platform by trying out our demo app. To see the SDK in action, check out our example app.