This repo contains templates for creating new dotnet projects, solutions, etc.
dotnet new install .or, if there were any changes to an already installed template:
dotnet new install . --forceThe first template is vm2 Add New NuGet Package Solution (short name vm2pkg), which scaffolds a new .NET package repository with conventional structure, GitHub Actions workflows, and optional components.
- .NET SDK 10.0.101
ghCLI (used by the generated bootstrap script)
dotnet new vm2pkg \
--name MyPackage \
--initialVersion 0.1.0 \
--license MIT \
--repositoryOrg vmelamed \
--includeBenchmarks true \
--includeExamples true \
--includeDocs trueThen run the generated scripts/bootstrap-new-package.sh to create and push the GitHub repo (uses gh repo create, default visibility public, requires authentication).
| Parameter | Default | Description |
|---|---|---|
--name |
(required) | Package/project name (PascalCase); repo becomes vm2.<name> |
--initialVersion |
0.1.0 |
Initial version used in README/CHANGELOG; MinVer computes build versions |
--license |
MIT |
One of MIT, Apache-2.0, BSD-3; materializes LICENSE and SPDX headers |
--repositoryOrg |
vmelamed |
GitHub org/user for URLs and bootstrap defaults |
--includeBenchmarks |
true |
Include benchmarks/<name>.Benchmarks |
--includeExamples |
true |
Include examples/<name>.Example |
--includeDocs |
true |
Include docs/ stub |
-
.NET solution skeleton with shared settings in:
-
Workflows from org templates: CI, Prerelease, Release, ClearCache under
.github/workflows/ -
Dependabot config in
.github/dependabot.yml -
Library project
src/<name>/with SPDX headers and XML docs enabled -
Standard file structure:
vm2.<name>/ ├── .github/ │ └── dependabot.yml │ └── workflows/ │ ├── ClearCache.yaml │ ├── CI.yaml │ ├── Prerelease.yaml │ └── Release.yaml ├── benchmarks/ # Benchmark projects (recommended) │ └── vm2.<name>.Benchmarks/ ├── src/ # Source code │ └── vm2.<name>/ ├── test/ # Test projects (highly recommended) │ └── vm2.<name>.Tests/ ├── .editorconfig ├── .gitattributes ├── .gitignore ├── codecov.yml ├── Directory.Build.props ├── Directory.Packages.props ├── global.json ├── test.runsettings ├── README.md ├── LICENSE └── CHANGELOG.md -
tests under
test/<name>.Tests/(xUnit + FluentAssertions + MTP + coverage)- MTP v1 when built and run inside Visual Studio Test Explorer
- MTP v2 when run via
dotnet runCLI, or run the test executable, or in Visual Studio Code Test Explorer
-
optional benchmarks under
benchmarks/<name>.Benchmarks/using BenchmarkDotNet -
optional console example under
examples/<name>.Example/ -
scripts folder with bootstrap helper and
_common.shutilities -
Packaging metadata patterned after vm2.Ulid (packable, SourceLink, MinVer tag prefix
v, README/CHANGELOG/LICENSE packing entries).
scripts/bootstrap-new-package.sh (SPDX uses selected license) will:
- Require
ghand authentication - Create repo
vm2.<name>under--org(defaultvmelamed) with--visibility(defaultprivate) - Init git if needed, commit scaffold, set origin, push
main.
- Set required variables:
DOTNET_VERSIONCONFIGURATIONMAX_REGRESSION_PCTMIN_COVERAGE_PCTMINVERTAGPREFIXNUGET_SERVER
- Set required secrets in the new GitHub repo:
CODECOV_TOKENNUGET_API_GITHUB_KEYNUGET_API_NUGET_KEYNUGET_API_KEY(if NUGET_SERVER is set to a custom server)BENCHER_API_TOKEN
- Set debug flags (variables):
ACTIONS_RUNNER_DEBUGgenerates detailed logs about how the runner executes jobsACTIONS_STEP_DEBUGmore granular details in the step logs
- Protect
mainwith required checks and require PRs. Suggested check names:build(job id from CI workflow "CI: Build, Test, Benchmark")test(job id from CI workflow "CI: Build, Test, Benchmark")benchmark(job id from CI workflow "CI: Build, Test, Benchmark")
- Update README/CHANGELOG content and package metadata as needed.
- templates/AddNewPackage/.template.config: template definition
- templates/AddNewPackage/content: payload files used by
dotnet new - scripts/: shared helper scripts (copied into generated repos)
- Keep template content minimal and rely on shared props/central package management.
- Optional folders are conditionally excluded based on include flags.
- Bootstrap script follows the style of vm2.DevOps
_common.shhelpers for consistency.