There is a comprehensive documentation for creating a custom template. Here is the steps for packageing:
A custom template is packed with the dotnet
pack command and a
.csproj
file. Alternatively, NuGet can be used with the nuget
pack
command along with a .nuspec
file. However, NuGet requires the .NET
Framework on Windows and Mono on Linux and macOS.
The .csproj
file is slightly different from a traditional code-project .csproj
file. Note the following settings:
- The setting is added and set to Template.
- The setting is added and set to a valid NuGet
version number.
- The setting is added and set to a unique identifier.
This identifier is used to uninstall the template pack and is used
by NuGet feeds to register your template pack.
- Generic metadata settings should be set: , ,
, and .
- The setting must be set, even though the binary
produced by the template process isn't used. In the example below
it's set to netstandard2.0.
See this for a working example.