Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

DNT (DotNetTools)

Command line tools to manage .NET Core, Standard and SDK-style projects and solutions

NuGet Version npm

Command and parameter names may improve or change over time. Please create issues or PRs if you'd like to fix, change or add a command.


.NET Core global tool

Requires .NET Core 2.2+ and Visual Studio 2019

Install .NET Core global tool:

dotnet tool install -g dnt

Update the global tool:

dotnet tool update -g dnt

Uninstall the tool:

dotnet tool uninstall -g dnt

NPM CLI package

Requires .NET Core 2.2+ or NetFX 4.7.2 and Visual Studio 2019

Globally install/update via NPM (.NET 4.6.2+ and .NET Core 2.1+):

npm i -g dotnettools

Uninstall global package:

npm uninstall -g dotnettools


By default, all commands search in the current directory for all *.csproj files and apply the command to all of them. The targeted projects or solutions can be changed with the /path:MyProject.csproj parameter.

To list all currently selected projects, call:

dnt list-projects

dnt list-projects /path:MySolution.sln

Available commands:

Possible scenarios to use the tools:

Package Commands


Installs a NuGet package in the selected projects.


dnt install-packages PackageToInstall [TargetPackageVersion] [/path:ProjectDirectoryPath]


  • PackageToInstall
  • TargetPackageVersion
  • ProjectDirectoryPath


Updates NuGet packages in the selected projects.


dnt update-packages PackagesToUpdate [TargetPackageVersion] [/path:ProjectDirectoryPath]


  • PackagesToUpdate: The package ID to update, also supports * wildcards
  • TargetPacketVersion: The targeted package version (default: latest)
  • ProjectDirectoryPath


Update all packages in the selected projects to the latest version:

dnt update-packages *

Update the Newtonsoft.Json packages in the selected projects to version 10.0.1:

dnt update-packages Newtonsoft.Json 10.0.1

Update all packages which start with MyPackages. to version 2.1.0 in the selected projects:

dnt update-packages MyPackages.* 2.1.0


Increases or changes the package version of the selected projects.


dnt bump-versions major|minor|patch|revision [number]


  • Action: Specifies the version segment to bump (major|minor|patch|revision) by 1 or by the specified number
  • Number: The version to bump up to (if not specified: Increase by 1)


Bump the minor version of all selected projects by 1:

dnt bump-versions minor

Set the patch version of all selected projects to 18:

dnt bump-versions patch 18


This command switches NuGet assembly references to project references and vice-versa. This is useful when developing applications/libraries which reference own NuGet packages: When developing an application, switch to project references so that all code is editable and debuggable. After finishing the development, create new NuGet package versions, switch back to NuGet references and upgrade to the new NuGet versions.

This command supports .csproj, .vbproj, legacy and SDK-style projects (.NET Core/Standard). Previously it was implemented as a Visual Studio extension: NuGetReferenceSwitcher.


Create a switcher.json file and specify the solution to look for projects, and the NuGet packages to replace with actual projects. The involved projects are only specified by the solution path in the settings file.

The command supports switching to project references where the NuGet package is built from a single project or when it is built from multiple projects, i.e. the package contains multiple libraries.

Sample - single project per package: Here we create a switcher file for NSwag which references libraries of NJsonSchema to work on both projects in a single solution:

  "solution": "NSwag.sln",
  "mappings": {
    "NJsonSchema": "../../NJsonSchema/src/NJsonSchema/NJsonSchema.csproj",
    "NJsonSchema.CodeGeneration": "../../NJsonSchema/src/NJsonSchema.CodeGeneration/NJsonSchema.CodeGeneration.csproj",
    "NJsonSchema.CodeGeneration.CSharp": "../../NJsonSchema/src/NJsonSchema.CodeGeneration.CSharp/NJsonSchema.CodeGeneration.CSharp.csproj",
    "NJsonSchema.CodeGeneration.TypeScript": "../../NJsonSchema/src/NJsonSchema.CodeGeneration.TypeScript/NJsonSchema.CodeGeneration.TypeScript.csproj"

Sample - multiple projects per package: Here we create a switcher file for a sample solution which references multiple libraries included (as dependencies) in the UA-.NETStandard OPCFoundation.NetStandard.Opc.Ua package in order to work on all the projects in a single solution.

  "solution": "MyOpcUaApp.sln",
  "mappings": {
    "OPCFoundation.NetStandard.Opc.Ua": [

Then switch to projects in the solution:

dnt switch-to-projects

The command looks for switcher.json configuration file by default, but you can specify your own file:

dnt switch-to-projects switch-config.json

Now all NJsonSchema, or UA-.NETStandard, package references in the NSwag, or MyOpcUaApp, solution are replaced by local project references and the NJsonSchema, or UA-.NETStandard, projects are added to the solution.

Optional switcher.json Flags:

  • removeProjects: (Default: true) Removes mapped projects from the solution and ignores mapped projects when using switch-to-packages.


After implementing and testing, switch back to NuGet references and update to the latest version:

dnt switch-to-packages
dnt update-packages NJsonSchema*
# or
dnt update-packages OPCFoundation.NetStandard.Opc.Ua.*


Lists all used packages, transitive packages in the projects and their licenses.


  • ExcludeMicrosoft (default: true): Exclude packages which start with Microsoft.*
  • ExcludeSystem (default: true): Exclude packages which start with System.*
  • IncludeTransitiveDependencies (default: true): Also analyze transitive dependencies (i.e. indirectly referenced packages)

Sample output for NJsonSchema:

Package                              Version   #   License   License URL
BenchmarkDotNet                      0.10.14   1   MIT
BenchmarkDotNet.Core                 0.10.14   4   MIT
BenchmarkDotNet.Toolchains.Roslyn    0.10.14   1   MIT
DotLiquid                            2.0.254   1   Apache
NBench                               1.0.4     2   Apache
Newtonsoft.Json                      9.0.1     4   MIT
NodaTime                             2.2.0     2   Apache
Pro.NBench.xUnit                     1.0.4     1   MIT
xunit                                2.3.1     7   Apache
xunit.abstractions                   2.0.1     2   Apache
xunit.analyzers                      0.7.0     1   Apache
xunit.assert                         2.3.1     1   Apache
xunit.core                           2.3.1     1   Apache
xunit.extensibility.core             2.3.1     3   Apache
xunit.extensibility.execution        2.3.1     1   Apache
xunit.runner.visualstudio            2.3.1     6   Apache
YamlDotNet.Signed                    5.0.1     1   MIT


Looks through all the projects for assembly/DLL references that could instead be project references in the same solution.

The command does make the assumption that the assembly output of a project has the same name as the project.

dnt switch-assemblies-to-projects

Looks for references like

<Reference Include="ProjectA">

And replaces with

<ProjectReference Include="..\ProjectA\ProjectA.csproj">

Project Commands


Enables a project feature in all selected projects.


dnt enable warnaserror|xmldocs


  • Action: Specifies the feature to enable (warnaserror|xmldocs)


Handle all warnings as errors in all selected projects:

dnt enable warnaserror


Adds a diagnostic id to the <NoWarn> tag (supports muliple ids, semicolon separated).


Disable "Missing XML comment for publicly visible type or member" warnings in all selected projects:

dnt nowarn CS1591


Add another target framework to the selected projects.


dnt add-target-framework TargetFramework


  • TargetFramework: Specifies the target framework to add


Add .NET Standard 2.0 target framework to all projects:

dnt add-target-framework netstandard2.0


Deletes all /bin and /obj directories of the selected projects.


Replaces or sets the package version of the selected projects. Projects must have the GeneratePackageOnBuild flag set.


dnt change-versions version [replace|force]


  • Version: The full version number using the format 'major.minor[.patch][.revision]'. Version will be padded to three parts.
  • Action: Action to perform (replace|force). replace (default) = Only set for projects with an existing version, force = Set for all projects even if version is missing or blank


Replace projects with an existing version tag with 1.0.1:

dnt change-versions 1.0.1

Force set all projects to 1.2.0

dnt change-versions 1.2 force

Replace version with a long version:

dnt change-versions replace

DNT development and testing

It is recommended to add the debug output path "DNT/src/Dnt.NetFx/bin/Debug" to the Path environment variable, or directly start the app with a command.


DNT (DotNetTools): Command line tools to manage .NET projects and solutions.







No releases published


No packages published