Skip to content

Project templates

Nikolay Pianikov edited this page Aug 25, 2021 · 8 revisions

Project templates

Pure.DI provides project templates to set up your DI-based project easily. The template exists for the C# language.

How to install the templates

The templates require the .NET SDK. Run the following command to install Pure.DI templates for dotnet new:

dotnet new -i Pure.DI.Templates

If you want to uninstall templates:

dotnet new -u Pure.DI.Templates

The template is a NuGet package distributed over NuGet: NuGet.

Basic usage

To create a new C# DI-based console project from the template, run:

dotnet new di

After that, you can run the created application:

dotnet run

Project template specific options

By default, a console application project targeting net5.0 is created. You can specify -f or --framework to change a targeting framework:

dotnet new di -f netcoreapp3.1

The option --classlib creates a class library app project targeting netstandard2.0 by default:

dotnet new di --classlib

The option -c or --composerName sets the name of the "composer" class:

dotnet new di -c ClockDomain

By default, a create projects resolve to the highest acceptable stable version of Pure.DI. You can specify this version manually by the option _-v or --version:

dotnet new di -v 1.0.4

Use the -h or --help option to display all possible arguments with a description and the default values:

dotnet new di --help

Clone this wiki locally