Introduction
This guide walks you through setting up your first Agility CMS website using .NET. By the end, you'll have a fully functional site running locally with content from your Agility CMS instance.
This guide walks you through setting up your first Agility CMS website using .NET. By the end, you'll have a fully functional site running locally with content from your Agility CMS instance.
Before you begin, ensure you have:
defaultlive)defaultpreview)git clone https://github.com/agility/agilitycms-dotnet-starter.git
cd agilitycms-dotnet-starter
Choose your preferred starter:
# For Blazor SSR (recommended for modern apps)
cd Agility.NET.Blazor.Starter
# Or for MVC/Razor Pages (traditional approach)
cd Agility.NET.MVC.Starter
Create a file named appsettings.local.json in the project root:
{
"AppSettings": {
"InstanceGUID": "your-instance-guid",
"SecurityKey": "your-security-key",
"FetchAPIKey": "defaultlive.your-fetch-api-key",
"PreviewAPIKey": "defaultpreview.your-preview-api-key"
}
}
Security Note: The
appsettings.local.jsonfile is gitignored and won't be committed to version control. Never commit API keys to your repository.
# Install .NET dependencies
dotnet restore
# Install Node dependencies (for Tailwind CSS)
npm install
# Run with hot reload
dotnet watch
Your site will be available at http://localhost:5000.
Now that your site is running, explore these topics:
appsettings.local.jsonChannelName matches your sitemap channel (default: website)Clear browser cookies for localhost or hard refresh (Ctrl+Shift+R / Cmd+Shift+R).
Run npm install to install Tailwind dependencies, then restart dotnet watch.
SecurityKey is correctagilitypreviewkey parameterBoth starters follow a similar structure:
├── Components/ or ViewComponents/ # Content modules
├── Models/ # Content type definitions
├── Middleware/ # URL redirects, caching
├── Services/ # Agility API integration
├── appsettings.json # Default configuration
├── appsettings.local.json # Your API credentials (gitignored)
└── Program.cs # Application setup
See the starter-specific guides for detailed structure documentation: