Collection of DMNSN .NET project templates for dotnet new and Visual Studio.
$ dotnet add package DMNSN.ProjectTemplatesModern .NET project templates featuring Serilog logging, dependency injection, configuration, and opinionated defaults for jump-starting production-ready solutions.
Maintained individually—responses to questions and issues may take time, but feedback is always welcome in the Discussions tab.
All templates target .NET 8.0 and embrace a database-first pattern backed by SQL Server where applicable.
.\scripts\templates\Export-DotnetCliTemplate.ps1
src are exported.-Projects "ConsoleApp","Library" to export specific templates.-DryRun to preview changes or -LogPath to specify a custom log file..nupkg files in artifacts to install or update the templates for dotnet new.
dotnet new install .\artifacts\<template-name>.nupkg
artifacts.dotnet new install with the newer .nupkg to update an existing installation.For project-specific coding conventions, see the README.md in each src/DMNSN.Templates.Projects.* folder.
dotnet new uninstall DMNSN.ConsoleApp.CSharp
dotnet new list DMNSN shows all installed DMNSN templates; the Identity column is the value for dotnet new uninstall.src/DMNSN.Templates.Projects.* folder contains a template.config.json with an identity property that matches the uninstall name.This project includes PowerShell scripts to automate template creation, packaging, and publishing for dotnet new.
Export-DotnetCliTemplate.ps1)This is the primary script for creating a .nupkg template package from the source projects. It reads template.config.json from each project, generates template.json files, and bundles them into a NuGet package.
Common Usage:
Export all templates:
.\scripts\templates\Export-DotnetCliTemplate.ps1
Export specific templates:
.\scripts\templates\Export-DotnetCliTemplate.ps1 -Projects "ConsoleApp", "WebApiRest"
Set a specific package version:
.\scripts\templates\Export-DotnetCliTemplate.ps1 -Version 1.2.3
Preview changes without writing files:
.\scripts\templates\Export-DotnetCliTemplate.ps1 -DryRun
Key Parameters:
-Projects <string[]>: A list of project names to export (e.g., "ConsoleApp"). If omitted, all projects in src are exported.-Version <string>: Overrides the auto-incremented package version.-DryRun: Shows what would happen without actually creating files.-NoPack: Prepares the template folders in output but stops before creating a .nupkg.-InstallLatestPackage: After creating the package, it uninstalls any existing version and installs the new one.-TemplatesPath <string>: Overrides the staging folder for generated templates (default: output).-PackagesPath <string>: Controls where .nupkg files are written (default: artifacts).-AggregateConfigPath <string>: Path to the running version config (default: templatepack.config.json).-LogPath <string>: Specifies a path for the log file.Nuget-Published.ps1)This script automates the entire release process for the dotnet new template pack. It runs the export script, commits version changes, creates a git tag, and pushes the package to NuGet.
Common Usage:
Export, tag, and push to NuGet (requires NUGET_API_KEY env var):
.\scripts\templates\Nuget-Published.ps1
Only export the package, without tagging or pushing:
.\scripts\templates\Nuget-Published.ps1 -ExportOnly
Export and automatically commit/push version changes:
.\scripts\templates\Nuget-Published.ps1 -AutoCommit -AutoPush
Key Parameters:
-ExportOnly: Runs the export process but skips git tagging and NuGet push.-AutoCommit: Automatically commits changes to templatepack.config.json if the version was bumped.-AutoPush: Pushes the auto-commit to the remote repository.-CommitMessage <string>: A custom commit message (placeholders {version} and {tag} are available).Each template folder contains a template.config.json file. The export script reads this metadata and generates a rich .vstemplate manifest automatically.
Use this file as a quick pointer when browsing the repository structure:
template.config.json of the template you want to export../scripts/templates/Export-DotnetCliTemplate.ps1 -Projects "ConsoleApp" (swap in your project name) to regenerate the .template.config folder and pack a .nupkg for the dotnet CLI.{
"name": "Template Display Name",
"description": "Detailed description of the template",
"defaultNamespace": "YourProject.Namespace"
}
{
"name": "DMNSN Console Application",
"description": "A modern console application template with logging, dependency injection, and configuration support",
"defaultNamespace": "DMNSN.Templates.Projects.ConsoleApp",
"author": "DMNSN",
"version": "8.0.1",
"tags": ["console", "application", "logging", "dependency-injection", "configuration"],
"category": "Console Applications",
"projectType": "CSharp",
"languageTag": "csharp",
"platformTag": "windows",
"projectTypeTag": "console",
"sortOrder": 1000,
"createNewFolder": true,
"provideDefaultName": true,
"locationField": "Enabled",
"enableLocationBrowseButton": true,
"createInPlace": true,
"requiredFrameworkVersion": "8.0",
"supportedLanguages": ["C#"],
"templateGroupIdentity": "DMNSN.Templates.Applications",
"maxFrameworkVersion": "8.0"
}
| Property | Type | Description |
|---|---|---|
name | string | Display name that appears in Visual Studio |
description | string | What the template provides |
defaultNamespace | string | Default namespace for generated projects |
| Property | Type | Default | Description | Examples |
|---|---|---|---|---|
author | string | "Unknown" | Template author name | "DMNSN" |
version | string | "1.0.0" | Semantic version used for packaging | "8.0.1" |
tags | array | [] | Comma-separated metadata tags | "console", "logging" |
category | string | "General" | Custom grouping label | "Console Applications" |
projectType | string | "CSharp" | Visual Studio root category | "CSharp", "Web" |
languageTag | string | "C#" | Language filter chip | "csharp" |
platformTag | string | "Windows" | Platform filter chip | "windows", "azure" |
projectTypeTag | string | "project" | Template type filter | "console", "service", "library" |
sortOrder | number | 1000 | Ordering inside category | 900 |
createNewFolder | boolean | true | Creates a new folder when instantiating | true/false |
provideDefaultName | boolean | true | Supplies a default project name | true/false |
locationField | string | "Enabled" | Controls location textbox | "Enabled", "Hidden" |
enableLocationBrowseButton | boolean | true | Shows the browse button | true/false |
createInPlace | boolean | true | Keeps project files in the selected folder | true/false |
requiredFrameworkVersion | string | "4.0" | Minimum .NET version | "8.0" |
maxFrameworkVersion | string | "" | Maximum .NET version | "8.0" |
templateGroupIdentity | string | "" | Logical grouping across templates | "DMNSN.Templates.Applications" |
supportedLanguages | array | ["C#"] | Language list for template | ["C#"], ["C#","F#"] |
Project type (projectType)
Language tags (languageTag)
Platform tags (platformTag)
Project type tags (projectTypeTag)
// Console Application
{
"projectType": "CSharp",
"category": "Console Applications",
"languageTag": "csharp",
"platformTag": "windows",
"projectTypeTag": "console"
}
// Web API
{
"projectType": "CSharp",
"category": "Web APIs",
"languageTag": "csharp",
"platformTag": "windows",
"projectTypeTag": "web"
}
// Worker Service
{
"projectType": "CSharp",
"category": "Services",
"languageTag": "csharp",
"platformTag": "windows",
"projectTypeTag": "service"
}
// Class Library
{
"projectType": "CSharp",
"category": "Class Libraries",
"languageTag": "csharp",
"platformTag": "any",
"projectTypeTag": "classlib"
}
.vstemplate| Config property | <TemplateData> element |
|---|---|
name | <Name> |
description | <Description> |
projectType | <ProjectType> |
sortOrder | <SortOrder> |
createNewFolder | <CreateNewFolder> |
defaultNamespace | <DefaultName> |
provideDefaultName | <ProvideDefaultName> |
locationField | <LocationField> |
enableLocationBrowseButton | <EnableLocationBrowseButton> |
createInPlace | <CreateInPlace> |
author | <Author> |
version | <Version> |
tags | <ProjectSubType> |
category | <ProjectCategory> |
languageTag | <LanguageTag> |
platformTag | <PlatformTag> |
projectTypeTag | <ProjectTypeTag> |
requiredFrameworkVersion | <RequiredFrameworkVersion> |
maxFrameworkVersion | <MaxFrameworkVersion> |
templateGroupIdentity | <TemplateGroupID> |
supportedLanguages | <SupportedLanguages> |
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>DMNSN Console Application</Name>
<Description>A modern console application template with logging, dependency injection, and configuration support</Description>
<ProjectType>CSharp</ProjectType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>DMNSN.Templates.Projects.ConsoleApp</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<CreateInPlace>true</CreateInPlace>
<Icon>__TemplateIcon.ico</Icon>
<PreviewImage>__TemplatePreview.png</PreviewImage>
<Author>DMNSN</Author>
<ProjectSubType>console,application,logging,dependency-injection,configuration</ProjectSubType>
<ProjectCategory>Console Applications</ProjectCategory>
<LanguageTag>csharp</LanguageTag>
<PlatformTag>windows</PlatformTag>
<ProjectTypeTag>console</ProjectTypeTag>
<RequiredFrameworkVersion>8.0</RequiredFrameworkVersion>
<MaxFrameworkVersion>8.0</MaxFrameworkVersion>
<TemplateGroupID>DMNSN.Templates.Applications</TemplateGroupID>
<SupportedLanguages>C#</SupportedLanguages>
</TemplateData>
<TemplateContent>
<!-- Project files and structure -->
</TemplateContent>
</VSTemplate>
Running the export script provides clear feedback about each template:
⚙ Processing 'DMNSN.Templates.Projects.ConsoleApp'...
📋 Template Name: DMNSN Console Application
👤 Author: DMNSN
🔢 Version: 8.0.1
🏷️ Tags: console,application,logging,dependency-injection,configuration
📂 Category: Console Applications
🎯 Project Type: CSharp
src/DMNSN.Templates.Projects.ConsoleApp and src/DMNSN.Templates.Projects.Library.