dotnet-run(1)
π dotnet-run(1) β the .NET docs, but make it make sense π
okay bestie, welcome to dotnet-run(1) from the .NET Documentation set π this is the page for the dotnet run command, and it applies to: βοΈ .NET 6 SDK and later versions. yes, 6 and up, if you're on something older this page is not your moment π
β¨ NAME β¨
dotnet-run β Runs source code without any explicit compile or launch commands. it literally just does the thing for you π«Ά
β¨ SYNOPSIS β¨
dotnet run [<applicationArguments>]
[-a|--arch <ARCHITECTURE>] [--artifacts-path <ARTIFACTS_DIR>]
[-c|--configuration <CONFIGURATION>] [-e|--environment <KEY=VALUE>]
[--file <FILE_PATH>] [-f|--framework <FRAMEWORK>] [--force] [--interactive]
[--launch-profile <NAME>] [--no-build] [--no-dependencies]
[--no-launch-profile] [--no-restore] [--os <OS>] [--project <PATH>]
[-r|--runtime <RUNTIME_IDENTIFIER>] [--tl:[auto|on|off]]
[-v|--verbosity <LEVEL>] [[--] [application arguments]]
dotnet run -h|--help
β¨ DESCRIPTION β¨
so dotnet run is that girl π
she gives you a convenient option to run your application straight from the source code with just one command. it's lowkey perfect for fast iterative development from the command line. the way she works? she depends on the dotnet build command to build the code first. so every requirement that applies to the build also applies to dotnet run β no shortcuts, no exceptions, periodt.
π¨ heads up bestie:dotnet rundoesn't respect arguments like/property:property=value, which are respected bydotnet build. so don't come crying to her with those, she will simply not see them π
Output files get written into the default location, which is bin/<configuration>/<target>. like, for example, if you have a netcoreapp2.1 application and you run dotnet run, the output is placed in bin/Debug/netcoreapp2.1. files are overwritten as needed (she's not sentimental π) and temporary files are placed in the obj directory.
If your project specifies multiple frameworks, running dotnet run results in an error unless you use the -f|--framework <FRAMEWORK> option to specify which framework you actually mean. she needs you to pick a lane π¦
The dotnet run command is used in the context of projects, not built assemblies. so if you're trying to run a framework-dependent application DLL instead, you must use dotnet without a command. for example, to run myapp.dll, use:
dotnet myapp.dll
For more information on the dotnet driver, see .NET CLI overview. π
To run the application, the dotnet run command resolves the dependencies of the application that are outside of the shared runtime from the NuGet cache. and because it uses cached dependencies, it's not recommended to use dotnet run to run applications in production. instead, create a deployment using the dotnet publish command and deploy the published output. production is not her era, she's a dev-loop girlie π
πΈ Implicit restore πΈ
You don't have to run dotnet restore, bestie, because it's run implicitly by all commands that require a restore to occur, such as dotnet new, dotnet build, dotnet run, dotnet test, dotnet publish, and dotnet pack. to disable implicit restore, use the --no-restore option. that's the off switch π
The dotnet restore command is still useful in certain scenarios where explicitly restoring makes sense, like continuous integration builds in Azure DevOps Services, or in build systems that need to explicitly control when the restore occurs. so she's not useless, she's just situational β¨
For information about how to manage NuGet feeds, see the dotnet restore documentation.
This command supports the dotnet restore options when passed in the long form (for example, --source). short form options, such as -s, are not supported. long form or nothing, iykyk π
π Workload manifest downloads π
When you run this command, it initiates an asynchronous background download of advertising manifests for workloads. if the download is still running when this command finishes, the download is stopped. for more information, see Advertising manifests. she starts it, she doesn't wait around for it π
β¨ ARGUMENTS β¨
<applicationArguments>β Arguments passed to the application that is being run.
Any arguments that aren't recognized by dotnet run are passed to the application. so like, she's generous, she'll forward them π«Ά but to separate arguments for dotnet run from arguments for the application, use the -- option. that little double-dash is the divider between "her business" and "your app's business" β
to be continued... π¦
β¨ OPTIONS β¨
--β the lil fence between your args and the app's args π Everything after this delimiter gets passed to the application being run. Not todotnet runitself. Just the app. Okay bestie? periodt.-a,--arch <ARCHITECTURE>β sets the target architecture π¦ This is a shorthand syntax for setting the Runtime Identifier (RID), where the value you give gets combined with the default RID. Like, on awin-x64machine, specifying--arch x86sets the RID towin-x86. If you use this option, do not also use-r|--runtime. Available since .NET 6 Preview 7 β¨--artifacts-path <ARTIFACTS_DIR>β all the build output files from the executed command go in subfolders under the path you specify, separated by project π For more info, see Artifacts Output Layout. Available since .NET 8 SDK.-c,--configuration <CONFIGURATION>β defines the build configuration π The default for most projects isDebug, but you can override the build configuration settings in your project. Do your thing.--disable-build-serversβ forces the command to ignore any persistent build servers π This gives you a consistent way to disable all use of build caching, which forces a build from scratch. A build that doesn't rely on caches is useful when the caches might be corrupted or incorrect for some reason. Available since .NET 7 SDK.-e,--environment <KEY=VALUE>β sets the specified environment variable in the process that will be run by the command πΈ Important: the specified environment variable is not applied to thedotnet runprocess itself.
Environment variables passed through this option take precedence over ambient environment variables, System.CommandLine env directives, and environmentVariables from the chosen launch profile. For more information, see Environment variables.
This option was added in .NET SDK 9.0.200. Fresh off the press π
-f,--framework <FRAMEWORK>β builds and runs the app using the specified framework π§ The framework must be specified in the project file, no cap.--file <FILE_PATH>β the path to the file-based app to run π If a path isn't specified, the current directory is used to find and run the file. For more info on file-based apps, see Build file-based C# apps.
On Unix, you can run file-based apps directly, using the source file name on the command line instead of dotnet run. First, make sure the file has execute permissions. Then add a shebang line #! as the first line of the file, like:
#!/usr/bin/env dotnet run
Then you can run the file directly from the command line:
./ConsoleApp.cs
Introduced in .NET SDK 10.0.100 β¨
--forceβ forces all dependencies to be resolved even if the last restore was successful π₯ Specifying this flag is the same as deleting theproject.assets.jsonfile. Same energy, less typing.--interactiveβ allows the command to stop and wait for user input or action π For example, to complete authentication. Available since .NET Core 3.0 SDK.--launch-profile <NAME>β the name of the launch profile (if any) to use when launching the application π Launch profiles are defined in thelaunchSettings.jsonfile and are typically calledDevelopment,Staging, andProduction. For more information, see Working with multiple environments.--no-buildβ doesn't build the project before running π« It also implicitly sets the--no-restoreflag. Two birds, one flag.--no-cacheβ skip up to date checks and always build the program before running π No shortcuts. We build.--no-dependenciesβ when restoring a project with project-to-project (P2P) references, restores the root project and not the references π--no-launch-profileβ doesn't try to uselaunchSettings.jsonto configure the application πΈ--no-restoreβ doesn't execute an implicit restore when running the command β¨--no-self-containedβ publish your application as a framework dependent application π A compatible .NET runtime must be installed on the target machine to run your application.--os <OS>β specifies the target operating system (OS) π¦ This is a shorthand syntax for setting the Runtime Identifier (RID), where the value you give gets combined with the default RID. Like, on awin-x64machine, specifying--os linuxsets the RID tolinux-x64. If you use this option, do not also use-r|--runtime. Available since .NET 6.--project <PATH>β specifies the path of the project file to run (folder name or full path) π If not specified, it defaults to the current directory.
The -p abbreviation for --project is deprecated starting in .NET 6 SDK. For a limited time, -p can still be used for --project despite the deprecation warning. If the argument provided for the option doesn't contain =, the command accepts -p as short for --project. Otherwise, the command assumes that -p is short for --property. This flexible use of -p for --project will be phased out in .NET 7. We love a chaotic era but it's ending bestie π
--property:<NAME>=<VALUE>β sets one or more MSBuild properties π
Specify multiple properties delimited by semicolons or by repeating the option:
--property:<NAME1>=<VALUE1>;<NAME2>=<VALUE2>
--property:<NAME1>=<VALUE1> --property:<NAME2>=<VALUE2>
The short form -p can be used for --property. If the argument provided for the option contains =, -p is accepted as short for --property. Otherwise, the command assumes that -p is short for --project.
To pass --property to the application rather than set an MSBuild property, provide the option after the -- syntax separator, for example:
dotnet run -- --property name=value
-r,--runtime <RUNTIME_IDENTIFIER>β specifies the target runtime to restore packages for π₯ For a list of Runtime Identifiers (RIDs), see the RID catalog.-sc,--self-containedβ publishes the .NET runtime with your application so the runtime doesn't need to be installed on the target system π The default isfalse. However, when targeting .NET 7 or lower, the default istrueif a runtime identifier is specified. Sneaky little default, iykyk.--tl:[auto|on|off]β specifies whether Terminal Logger should be used for the build output π The default isauto, which first verifies the environment before enabling terminal logging. The environment check verifies that the terminal is capable of using modern output features and isn't using a redirected standard output before enabling the new logger.onskips the environment check and enables terminal logging.offskips the environment check and uses the default console logger.
Terminal Logger shows you the restore phase followed by the build phase π During each phase, the currently building projects appear at the bottom of the terminal. Each project that's building outputs both the MSBuild target currently being built and the amount of time spent on that target. You can search this information to learn more about the build. When a project is finished building, a single "build completed" section is written that captures:
- The name of the built project.
- The target framework (if multi-targeted).
- The status of that build.
- The primary output of that build (which is hyperlinked).
- Any diagnostics generated for that project.
This option is available starting in .NET 8 β
-v,--verbosity <LEVEL>β sets the verbosity level of the command π¦ Allowed values areq[uiet],m[inimal],n[ormal],d[etailed], anddiag[nostic]. The default isminimal. For more information, see<xref:Microsoft.Build.Framework.LoggerVerbosity>.-?,-h,--helpβ prints out a description of how to use the command π«Ά Your bestie when you forget literally everything.
π ENVIRONMENT VARIABLES π
There are four mechanisms by which environment variables can be applied to the launched application, and you're gonna learn all of them:
- Ambient environment variables from the operating system when the command is run.
- System.CommandLine env directives, like
[env:key=value]. These apply to the entiredotnet runprocess, not just the project being run bydotnet run. environmentVariablesfrom the chosen launch profile (-lp) in the project'slaunchSettings.jsonfile, if any. These apply to the project being run bydotnet run.-e|--environmentCLI option values (added in .NET SDK version 9.0.200). These apply to the project being run bydotnet run.
The environment is constructed in the same order as this list, so the -e|--environment option has the highest precedence π Last one in wins, periodt.
π EXAMPLES π
- Run the project in the current directory:
dotnet run
- Run the specified file-based app in the current directory:
dotnet run --file ConsoleApp.cs
File-based app support was added in .NET SDK 10.0.100 β¨
- Run the specified project:
dotnet run --project ./projects/proj1/proj1.csproj
- Run the project in the current directory, specifying Release configuration:
dotnet run --property:Configuration=Release
- Run the project in the current directory (the
--helpargument in this example is passed to the application, since the blank--option is used):
dotnet run --configuration Release -- --help
- Restore dependencies and tools for the project in the current directory only showing minimal output and then run the project:
dotnet run --verbosity m
- Run the project in the current directory using the specified framework and pass arguments to the application:
dotnet run -f net6.0 -- arg1 arg2
In the following example, three arguments are passed to the application πΈ One argument is passed using -, and two arguments are passed after --:
dotnet run -f net6.0 -arg1 -- arg2 arg3
And that's the whole page bestie, you ate that π This one's from the dotnet-run(1) manual, dated 2025-10-30 β go forth and dotnet run something iconic πβ¨π
π¦ where this page comes from
- alpine 3.24: dotnet-doc 10.0.303-r2 Β· MIT
- centos-stream 10: dotnet-host 11.0.0~rc.2.26504.105-0.10.el10 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- centos-stream 9: dotnet-host 11.0.0~rc.2.26504.105-0.11.el9 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 43: dotnet-host 10.0.12-1.fc43
- fedora 43: dotnet-host 11.0.0~rc.1.26425.128-0.10.fc43 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 10.0.12-1.fc44
- fedora 44: dotnet-host 10.0.4-1.fc44 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 11.0.0~rc.1.26425.128-0.12.fc44 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- nixpkgs unstable: dotnet-vmr 11.0.0-rc.3
- ubuntu noble: dotnet-host-10.0 10.0.12-0ubuntu1~24.04.1
- ubuntu questing: dotnet-host-10.0 10.0.9-0ubuntu1~25.10.1
- ubuntu resolute: dotnet-host-10.0 10.0.12-0ubuntu1~26.04.1
- ubuntu resolute: dotnet-host-10.0 10.0.5-0ubuntu1 Β· MIT
- ubuntu stonking: dotnet-host-10.0 10.0.12-0ubuntu2 Β· MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc1-0ubuntu1 Β· MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc3-0ubuntu1~26.10.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms