Name
dotnet-run -- Runs "in-place" (i.e. the directory from which the command is run) source code without any explicit compile or launch commands.
Summary
`dotnet run [--framework] [--configuration]
[--project] [--help] [--]`
Description
The dotnet run command provides a convenient option , which is to use a command to run your application from source code.
It compiles the source code, generates an output program, and then runs that program.
This command is useful for rapid iterative development, and can also be used to run a source code distributed program (for example: website).
This command relies on dotnet build to generate source code input into a .NET assembly and then run the program.
This command and the requirements for processing the input source code are inherited from the generate command.
This documentation provides more information about these requirements for the build command.
The output file is written to the bin subfolder, creating it if it does not exist.
Files will be overwritten as needed.
Temporary files are written to the obj subfolder.
In the case of a project with multiple specific frameworks, dotnet run will select the .NET Core framework first. If these do not exist, an error will be output. To specify other frameworks, use the --framework parameter.
The dotnet run command must be used in the project context and does not generate assemblies. If you want to execute a DLL as a replacement, you should use the dotnet command without any parameters, like the following example:
dotnet myapp.dll
Options
--
Detach parameters from the running application dotnet run parameters.
All parameters after this command will be passed to the running application.
-f, --framework [FID]
Run an application with a given framework identifier (FID).
-c, --configuration [Debug|Release]
The configuration used when releasing. The default value is "Debug".
-p, --project [PATH]
Specify the project to run. It can be the path to a project.json file, or a directory containing a project.json file. If not specified, it defaults to the current directory.
Example
dotnet run
Run the project in the current directory.
dotnet run --project /projects/proj1/project.json
Run the specified project.
dotnet run --configuration Release -- --help
Run the project in the current directory. Since the -- argument is used, --help in the above is passed as an argument to the running application.