Exit codes are chosen to conform to existing standards or standardization attempts and well known exit code. See Related resources for more details
Exit Code | Reason |
---|---|
0 | Success |
70 | Unexpected internal software issue. |
73 | Can't create output file. |
100 | Instantiation Failed - Processing issues. |
101 | Invalid template or template package. |
102 | Missing required option(s) and/or argument(s) for the command. |
103 | The template or the template package was not found. |
104 | PostAction operation was cancelled. |
105 | Instantiation Failed - Post action failed. |
106 | Template/Package management operation Failed. |
107 - 113 | Reserved. |
127 | Unrecognized option(s) and/or argument(s) for a command. |
130 | Command terminated by user. |
To enable verbose logging in order to troubleshoot issue(s), set the DOTNET_CLI_CONTEXT_VERBOSE
environment variable to true
PowerShell:
$env:DOTNET_CLI_CONTEXT_VERBOSE = 'true'
Cmd:
set DOTNET_CLI_CONTEXT_VERBOSE=true
Unexpected result or issue. File a bug if you encounter this exit code.
This is a semi-standardized exit code (see EX_SOFTWARE in /usr/include/sysexits.h)
The operation was cancelled due to detection of an attempt to perform destructive changes to existing files. This can happen if you are attempting to instantiate template into the same folder where it was previously instantiated under same target name (specified via --name
option or defaults to the target directory name)
Example:
> dotnet new console
The template "Console App" was created successfully.
Processing post-creation actions...
Running 'dotnet restore' on C:\tmp\tmp.csproj...
Determining projects to restore...
Restored C:\tmp\tmp.csproj (in 47 ms).
Restore succeeded.
> dotnet new console
Creating this template will make changes to existing files:
Overwrite ./tmp.csproj
Overwrite ./Program.cs
Rerun the command and pass --force to accept and create.
For details on current exit code please visit https://aka.ms/templating-exit-codes#73
Destructive changes can be forced by passing --force
option.
This is a semi-standardized exit code (see EX_CANTCREAT in /usr/include/sysexits.h)
The template instantiation failed due to error(s). Caused by environment (failure to read/write template(s) or cache).
Reserved for future usage - described behavior is yet not implemented. Feature is tracked
Caused by erroneous template(s) (incomplete conditions, symbols or macros etc.). Exact error reason will be output to stderr.
Examples:
Missing mandatory properties in template.json
{
"author": "John Doe",
"name": "name",
}
Reserved for future usage - described behavior is only partially implemented. Some cases that should fall under this exit code are now leading to code 127 Issue is tracked
The exit code is used when one or more required options or/and arguments used for the command were not passed. Applicable to search
command with not enough information as well.
Applicable as well if template option marked as required was not passed during the template instantiation.
Examples:
> dotnet new my-template
Mandatory option '--MyMandatoryParam' is missing for the template 'My Template'.
For details on current exit code please visit https://aka.ms/templating-exit-codes#102
> dotnet new search
Search failed: not enough information specified for search.
To search for templates, specify partial template name or use one of the supported filters: '--author', '--baseline', '--language', '--type', '--tag', '--package'.
Examples:
dotnet new search web
dotnet new search --author Microsoft
dotnet new search web --language C#
For details on current exit code please visit https://aka.ms/templating-exit-codes#102
Applicable to instantiation, listing, remote sources searching and installation.
Examples:
> dotnet new xyz
No templates found matching: 'xyz'.
To list installed templates, run:
dotnet new list
To search for the templates on NuGet.org, run:
dotnet new search xyz
For details on current exit code please visit https://aka.ms/templating-exit-codes#103
> dotnet new list xyz
No templates found matching: 'xyz'.
To search for the templates on NuGet.org, run:
dotnet new search xyz
For details on current exit code please visit https://aka.ms/templating-exit-codes#103
> dotnet new search xyz
Searching for the templates...
Matches from template source: NuGet.org
No templates found matching: 'xyz'.
For details on current exit code please visit https://aka.ms/templating-exit-codes#103
> dotnet new install foobarbaz
The following template packages will be installed:
foobarbaz
foobarbaz could not be installed, no NuGet feeds are configured or they are invalid.
For details on current exit code please visit https://aka.ms/templating-exit-codes#103
Applicable to a case when user aborts run-script post action.
Applicable to a case when post action fails - unless it is configured to continue on errors.
The exit code is used for errors during templates installation, uninstallation or updates. Failure to download packages, read/write templates or cache, erroneous or corrupted template, or an attempt to install same package multiple times.
Example:
>dotnet nuget disable source nuget.org
Package source with Name: nuget.org disabled successfully.
> dotnet new install webapi2
The following template packages will be installed:
webapi2
Error: No NuGet sources are defined or enabled.
webapi2 could not be installed, the package does not exist.
For details on current exit code please visit https://aka.ms/templating-exit-codes#106
Reserved for future use.
File a bug if you encounter any of these exit codes.
The exit code is used when one or more options or/and arguments used in the command not recognized or invalid.
Usually a mismatch in type of the specified template option or unrecognized choice value.
Examples:
> dotnet new console --framework xyz
Error: Invalid option(s):
--framework xyz
'xyz' is not a valid value for --framework. The possible values are:
net6.0 - Target net6.0
net7.0 - Target net7.0
For details on current exit code please visit https://aka.ms/templating-exit-codes#127
dotnet new update --smth
Unrecognized command or argument '--smth'
Description:
Checks the currently installed template packages for update, and install the updates.
Usage:
dotnet new update [options]
Options:
--interactive Allows the command to stop and wait for user input or action (for
example to complete authentication).
--add-source, --nuget-source <nuget-source> Specifies a NuGet source to use during install.
--check-only, --dry-run Only check for updates and display the template packages to be updated
without applying update.
-?, -h, --help Show command line help.
For details on current exit code please visit https://aka.ms/templating-exit-codes#127
This is a semi-standardized exit code (see 127 - "command not found" in 'The Linux Documentation Project')
Reserved for future usage - described behavior is yet not implemented. Feature is tracked
The exit code is used if command is terminated after user non-forceful termination request (e.g. Ctrl-C
, Ctrl-Break
).
This is a semi-standardized exit code (see 130 - Script terminated by Control-C in 'The Linux Documentation Project')