This template creates a solution for producing a NuGet package, along with unit tests.
Create a new app in your current directory by running.
> dotnet new keboo.nuget
| Parameter | Description | Default |
|---|---|---|
--pipeline |
CI/CD provider to use. Options: github, azuredevops, none |
github |
--sln |
Use legacy .sln format instead of .slnx format | false |
--tests |
Testing framework to use. Options: xunit, mstest, tunit, none |
xunit |
Example with Azure DevOps:
> dotnet new keboo.nuget --pipeline azuredevops
Example with no CI/CD pipeline:
> dotnet new keboo.nuget --pipeline none
Example with legacy .sln format:
> dotnet new keboo.nuget --sln true
Example with MSTest:
> dotnet new keboo.nuget --tests mstest
Example with no tests:
> dotnet new keboo.nuget --tests none
This template uses a global.json file to specify the required .NET SDK version. To update the .NET SDK version:
- Update the
global.jsonfile in the solution root - Update the
<TargetFramework>in thecsprojfiles.
Build, test, pack, and deploy to NuGet.org included. Use --pipeline parameter to choose between GitHub Actions (default) or Azure DevOps Pipelines.
By default, this template uses the new .slnx (XML-based solution) format introduced in .NET 9. This modern format is more maintainable and easier to version control compared to the legacy .sln format.
Blog: Introducing slnx support in the dotnet CLI
Docs: dotnet sln command
If you need to use the legacy .sln format, use the --sln true parameter when creating the template.