Skip to content

Commit 1c04fc8

Browse files
Merge pull request #45558 from dotnet/main
Merge main into live
2 parents 5a4fd2b + 8328eb9 commit 1c04fc8

File tree

3 files changed

+34
-12
lines changed

3 files changed

+34
-12
lines changed

docs/core/tools/dotnet-run.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: dotnet run command
33
description: The dotnet run command provides a convenient option to run your application from the source code.
4-
ms.date: 11/27/2023
4+
ms.date: 03/26/2025
55
---
66
# dotnet run
77

@@ -15,6 +15,7 @@ ms.date: 11/27/2023
1515

1616
```dotnetcli
1717
dotnet run [-a|--arch <ARCHITECTURE>] [-c|--configuration <CONFIGURATION>]
18+
[-e|--environment <KEY=VALUE>]
1819
[-f|--framework <FRAMEWORK>] [--force] [--interactive]
1920
[--launch-profile <NAME>] [--no-build]
2021
[--no-dependencies] [--no-launch-profile] [--no-restore]
@@ -42,7 +43,7 @@ The `dotnet run` command is used in the context of projects, not built assemblie
4243
dotnet myapp.dll
4344
```
4445

45-
For more information on the `dotnet` driver, see the [.NET Command Line Tools (CLI)](index.md) topic.
46+
For more information on the `dotnet` driver, see [.NET CLI overview](index.md).
4647

4748
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. Because it uses cached dependencies, it's not recommended to use `dotnet run` to run applications in production. Instead, [create a deployment](../deploying/index.md) using the [`dotnet publish`](dotnet-publish.md) command and deploy the published output.
4849

@@ -62,6 +63,14 @@ To run the application, the `dotnet run` command resolves the dependencies of th
6263

6364
[!INCLUDE [configuration](../../../includes/cli-configuration.md)]
6465

66+
- **`-e|--environment <KEY=VALUE>`**
67+
68+
Sets the specified environment variable in the process that will be run by the command. The specified environment variable is *not* applied to the `dotnet run` process.
69+
70+
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](#environment-variables).
71+
72+
(This option was added in .NET SDK 9.0.200.)
73+
6574
- **`-f|--framework <FRAMEWORK>`**
6675

6776
Builds and runs the app using the specified [framework](../../standard/frameworks.md). The framework must be specified in the project file.
@@ -127,6 +136,17 @@ To run the application, the `dotnet run` command resolves the dependencies of th
127136

128137
[!INCLUDE [verbosity](../../../includes/cli-verbosity-minimal.md)]
129138

139+
## Environment variables
140+
141+
There are four mechanisms by which environment variables can be applied to the launched application:
142+
143+
1. Ambient environment variables from the operating system when the command is run.
144+
1. System.CommandLine `env` directives, like `[env:key=value]`. These apply to the entire `dotnet run` process, not just the project being run by `dotnet run`.
145+
1. `environmentVariables` from the chosen launch profile (`-lp`) in the project's [launchSettings.json file](/aspnet/core/fundamentals/environments#lsj), if any. These apply to the project being run by `dotnet run`.
146+
1. `-e|--environment` CLI option values (added in .NET SDK version 9.0.200). These apply to the project being run by `dotnet run`.
147+
148+
The environment is constructed in the same order as this list, so the `-e|--environment` option has the highest precedence.
149+
130150
## Examples
131151

132152
- Run the project in the current directory:

docs/core/tools/dotnet-sln.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: dotnet sln command
33
description: The dotnet-sln command provides a convenient option to add, remove, and list projects in a solution file.
4-
ms.date: 02/24/2025
4+
ms.date: 03/26/2025
55
---
66
# dotnet sln
77

@@ -80,9 +80,11 @@ dotnet sln list [-h|--help]
8080

8181
- **`SOLUTION_FILE`**
8282

83-
The solution file to use (either an *.sln* or *.slnx* file).
83+
The solution file (*.sln* or *.slnx* file) or [solution filter](/visualstudio/msbuild/solution-filters) (*.slnf* file) to use.
8484

85-
If unspecified, the command searches the current directory for an *.sln* or *.slnx* file and, if it finds exactly one, uses that file. If multiple solution files are found, the user is prompted to specify a file explicitly. If none are found, the command fails.
85+
If unspecified, the command searches the current directory for an *.sln*, *.slnx*, or *.slnf* file and, if it finds exactly one, uses that file. If multiple solution files or filters are found, the user is prompted to specify a file explicitly. If none are found, the command fails.
86+
87+
(Support for *.slnf* files was added in .NET SDK 9.0.3xx.)
8688

8789
#### Options
8890

@@ -140,7 +142,7 @@ Removes a project or multiple projects from the solution file.
140142
#### Synopsis
141143

142144
```dotnetcli
143-
dotnet sln [<SOLUTION_FILE>] remove <PROJECT_PATH> [<PROJECT_PATH>...]
145+
dotnet sln [<SOLUTION_FILE>] remove <PROJECT_PATH|PROJECT_NAME> [<PROJECT_PATH|PROJECT_NAME>...]
144146
dotnet sln [<SOLUTION_FILE>] remove [-h|--help]
145147
```
146148

@@ -152,9 +154,11 @@ dotnet sln [<SOLUTION_FILE>] remove [-h|--help]
152154

153155
If unspecified, the command searches the current directory for an *.sln* or *.slnx* file and, if it finds exactly one, uses that file. If multiple solution files are found, the user is prompted to specify a file explicitly. If none are found, the command fails.
154156

155-
- **`PROJECT_PATH`**
157+
- **`PROJECT_PATH` or `PROJECT_NAME`**
158+
159+
The path to, or name of, the project or projects to remove from the solution. Unix/Linux shell [globbing pattern](https://en.wikipedia.org/wiki/Glob_(programming)) expansions are processed correctly by the `dotnet sln` command.
156160

157-
The path to the project or projects to remove from the solution. Unix/Linux shell [globbing pattern](https://en.wikipedia.org/wiki/Glob_(programming)) expansions are processed correctly by the `dotnet sln` command.
161+
If a project name is provided instead of a path, the project in the solution that matches the name, regardless of its path, is removed. If more than one matching project is found in the solution, the command errors out. Omit the project file extension in the name. (Support for removing projects by name was added in .NET 10.)
158162

159163
#### Options
160164

docs/welcome.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ You can build many types of apps with .NET, such as cloud, IoT, and games, using
1515
For news about .NET, check the following blogs:
1616

1717
- [.NET Blog](https://devblogs.microsoft.com/dotnet/)
18-
- [ASP.NET Blog](https://devblogs.microsoft.com/aspnet/)
1918
- [The Visual Studio Blog](https://devblogs.microsoft.com/visualstudio/)
20-
- [The Visual Basic Team](https://devblogs.microsoft.com/vbteam/)
2119

2220
Also follow the latest .NET events:
2321

2422
- [.NET Conf](https://www.dotnetconf.net/)
25-
- [Microsoft Ignite](https://www.microsoft.com/ignite)
26-
- [Microsoft Build](https://www.microsoft.com/build)
23+
- [Microsoft Ignite](https://ignite.microsoft.com/)
24+
- [Microsoft Build](https://build.microsoft.com/)
2725

2826
For information about the latest features added to the .NET implementations and supported languages, see the following articles:
2927

0 commit comments

Comments
 (0)