Setting up your .NET 5 Development Environment

Once logged into Agility CMS, you'll want to grab your API credentials so your .NET 5 site can authenticate and retrieve data from your instance.

From your Agility CMS dashboard, click into Settings > API Keys.


Take note of these credentials and copy them somewhere temporarily as you'll need to use them later.

Get The Code

  1. Make sure you have the latest version of .NET installed on your machine (v5).
  2. Clone this repository, and open it in your favorite Text Editor.

Generate your Content Models

Agility provides an easy-to-use CLI tool that helps you download the Content Models from your Agility CMS instance, and generates the classes of the Content Models for you.

  1. cd into the Agility.NET5.AgilityCLI directory.
  2. Overwrite the values in the App.config file.
  3. Run dotnet run update preview.
# get these values from the API Keys page in Agility Settings =>
<?xml version="1.0" encoding="utf-8" ?> <configuration>
<appSettings> <add key="InstanceGUID" value="" /> <add key="WebsiteName" value="" /> <add key="FetchAPIKey" value="" /> <add key="PreviewAPIKey" value="" /> <add key="Path" value="" /> </appSettings> </configuration>


If using MacOS, you may need to use forward slashes ("/") in the value for your Path, e.g:

Widnows: ..\Agility.NET5.Starter\Models\AgilityModels.cs

MacOS: ../Agility.NET5.Starter/Models/AgilityModels.cs

Set up Authentication

  1. cd into the Agility.NET5.Starter directory.
  2. Open up the appsettings.json file.
  3. Overwrite the values in the appsettings.json file with the credentials you saved from before.
# get these values from the API Keys page in Agility Settings =>
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*", "AppSettings": { "InstanceGUID": "", "SecurityKey": "", "WebsiteName": "", "FetchAPIKey": "", "PreviewAPIKey": "", "Locales": "en-us", "ChannelName": "website", "CacheInMinutes": 5 } }

Start The Site

  • dotnet build => Builds your .NET project.
  • dotnet run => Builds & runs your .NET project.
  • dotnet clean => Cleans the build outputs of your .NET project.
0 out of 0 found this helpful



Please sign in to leave a comment.