Kemenkeu.Utility.Templates
1.9.2
dotnet new install Kemenkeu.Utility.Templates@1.9.2
Kemenkeu.Utility.Templates
A NuGet package containing multiple .NET templates for building enterprise applications with Kemenkeu standards.
📦 Package Information
- Package ID:
Kemenkeu.Utility.Templates - Installation:
dotnet new install Kemenkeu.Utility.Templates - Package Type: Template Package
🎯 Available Templates
1. Kemenkeu Web API (Clean Architecture) - Project Template
- Short Name:
kemenkeu-webapi - Type: Project template
- Description: Production-ready service template built with Clean Architecture, targeting .NET 10.0
- Usage:
dotnet new kemenkeu-webapi -n MyCompany.MyService -o ~/MyService
2. Kemenkeu Feature (CQRS + DDD) - Item Template
- Short Name:
kemenkeu-feature - Type: Item template (code scaffolding)
- Description: Generates a complete CQRS feature across all layers (Controller, Commands, Queries, Handlers, DTOs, Entity, Repository, DbContext)
- Usage:
dotnet new kemenkeu-feature -n Tag --plural Tags --rootNamespace MyCompany.MyService --storage sqlserver - Storage options:
sqlserver,postgresql,mongodb
See individual template READMEs for detailed documentation.
🏗️ Repository Structure
Kemenkeu.Utility.Templates/
├── working/
│ └── content/
│ ├── ProjectWebApiDomainDrivenDesign10/ # Project template (kemenkeu-webapi)
│ │ ├── .template.config/
│ │ │ └── template.json
│ │ ├── src/
│ │ ├── tests/
│ │ └── README.md
│ ├── FeatureTemplate/ # Item template (kemenkeu-feature)
│ │ ├── .template.config/
│ │ │ └── template.json
│ │ └── src/ # Template source files with conditionals
│ └── [FutureTemplate]/ # Add new templates here
├── Kemenkeu.Utility.Templates.csproj # Packaging project
└── README.md # This file
➕ Adding a New Template
Follow these steps to add a new template to the package:
Step 1: Create Template Directory
Create a new directory under working/content/ for your template:
mkdir -p working/content/YourNewTemplate
cd working/content/YourNewTemplate
Step 2: Create Template Structure
Your template directory should follow this structure:
YourNewTemplate/
├── .template.config/
│ └── template.json # REQUIRED: Template configuration
├── src/ # Source files (project structure)
├── tests/ # Test files (optional)
├── README.md # Template documentation (recommended)
└── [other files] # Additional template files
Step 3: Create template.json
Create .template.config/template.json with the following structure:
{
"$schema": "http://json.schemastore.org/template",
"author": "Your Name or Team",
"classifications": [
"Web",
"API"
],
"identity": "kemenkeu.yourtemplate.template",
"name": "Your Template Name",
"shortName": "your-template-shortname",
"sourceName": "Kemenkeu.Service", // This will be replaced when template is used
"preferNameDirectory": true,
"tags": {
"language": "C#",
"type": "project"
},
"symbols": {
"projectName": {
"type": "parameter",
"datatype": "text",
"replaces": "Kemenkeu.Service",
"defaultValue": "Kemenkeu.Service",
"description": "The name of your project"
}
// Add more symbols/parameters as needed
}
}
Important Fields:
identity: Must be unique across all templatesname: Display name shown when listing templatesshortName: Command used to invoke template (e.g.,dotnet new your-template-shortname)sourceName: Placeholder that gets replaced with user's project name
Step 4: Add Template Files
- Create your template files in the directory structure
- Use
Kemenkeu.Serviceas placeholder for project names (or whatever you set insourceName) - Files will be automatically processed by the template engine
Example file replacements:
Kemenkeu.Service→ User's project nameKemenkeu.Service.Api→{projectName}.Api- Namespace references will be automatically replaced
Step 5: Test Your Template Locally
Before packaging, test your template locally:
# From your template directory
cd working/content/YourNewTemplate
# Install the template locally
dotnet new install . --force
# Test creating a project
dotnet new your-template-shortname -n Test.Project -o ~/test-output
# Verify the generated project
cd ~/test-output
dotnet restore
dotnet build
# Uninstall when done testing
dotnet new uninstall working/content/YourNewTemplate
Step 6: Build and Test the Package
Build the NuGet package (all templates will be included):
# From repository root
cd /path/to/Kemenkeu.Utility.Templates
# Build the package
dotnet pack Kemenkeu.Utility.Templates.csproj -c Release
# The package will be created at:
# bin/Release/Kemenkeu.Utility.Templates.{version}.nupkg
Step 7: Test the Package Locally
Test the package before publishing:
# Install from local package
dotnet new install bin/Release/Kemenkeu.Utility.Templates.1.0.0.nupkg
# Verify your template is listed
dotnet new list | grep kemenkeu
# Test creating a project with your template
dotnet new your-template-shortname -n Test.Project -o ~/test-output
# Uninstall when done
dotnet new uninstall Kemenkeu.Utility.Templates
Step 8: Update Version and Publish
Update Version in
Kemenkeu.Utility.Templates.csproj:<Version>1.1.0</Version> <PackageVersion>1.1.0</PackageVersion>Rebuild Package:
dotnet pack Kemenkeu.Utility.Templates.csproj -c ReleasePush to NuGet:
dotnet nuget push bin/Release/Kemenkeu.Utility.Templates.1.1.0.nupkg \ --api-key YOUR_API_KEY \ --source https://api.nuget.org/v3/index.json
📋 Template Checklist
When adding a new template, ensure:
- Template directory created under
working/content/ -
.template.config/template.jsoncreated with uniqueidentity -
shortNameis clear and follows naming convention (kebab-case) - All placeholder names use the
sourceNamevalue - README.md created for template documentation
- Template tested locally before packaging
- Template works with
dotnet new installanddotnet new {shortname} - Generated project builds successfully
- Version bumped in
.csprojbefore publishing
🔍 Template Naming Conventions
- shortName: Use kebab-case (e.g.,
kemenkeu-webapi,kemenkeu-worker) - identity: Use reverse domain notation (e.g.,
kemenkeu.yourtemplate.template) - name: Use descriptive name with parentheses for clarification (e.g., "Kemenkeu Web API (Clean Architecture)")
📦 Packaging Details
The Kemenkeu.Utility.Templates.csproj automatically includes all templates from working/content/:
<Content Include="working\content\**\*"
Exclude="working\content\**\bin\**;working\content\**\obj\**">
<Pack>true</Pack>
<PackagePath>content\</PackagePath>
</Content>
This means:
- ✅ Any new template folder added will be automatically included
- ✅ Build artifacts (
bin/,obj/) are automatically excluded - ✅ No need to modify
.csprojwhen adding templates
🚀 Publishing Workflow
- Develop your template in
working/content/YourTemplate/ - Test locally using
dotnet new install - Document in the template's README.md
- Update version in
.csproj - Build package:
dotnet pack - Test package installation locally
- Publish to NuGet:
dotnet nuget push
📚 Resources
🤝 Contributing
When adding a new template:
- Follow the structure and conventions outlined above
- Ensure your template follows Kemenkeu coding standards
- Include comprehensive documentation in the template's README.md
- Test thoroughly before requesting package publication
- Update this README.md with the new template information
📝 Notes
- The package includes all templates from
working/content/- users get everything when they install - Each template must have a unique
identityandshortName - Version numbers should follow Semantic Versioning
- Always test locally before publishing to NuGet
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.9.2 | 257 | 4/13/2026 |
| 1.9.1 | 304 | 2/11/2026 |
| 1.9.0 | 286 | 2/11/2026 |
| 1.8.2 | 286 | 2/9/2026 |
| 1.8.1 | 285 | 2/6/2026 |
| 1.8.0 | 286 | 2/6/2026 |
| 1.7.14 | 339 | 1/6/2026 |
| 1.7.13 | 329 | 1/5/2026 |
| 1.7.12 | 323 | 1/5/2026 |
| 1.7.11 | 320 | 1/5/2026 |
| 1.7.10 | 422 | 12/24/2025 |
| 1.7.9 | 413 | 12/24/2025 |
| 1.7.8 | 407 | 12/23/2025 |
| 1.7.7 | 408 | 12/22/2025 |
| 1.7.6 | 409 | 12/22/2025 |
| 1.7.5 | 420 | 12/22/2025 |
| 1.7.4 | 691 | 12/11/2025 |
| 1.7.3 | 692 | 12/10/2025 |
| 1.7.2 | 697 | 12/9/2025 |
| 1.7.1 | 684 | 12/9/2025 |