Skip to content

Commit 2e35e21

Browse files
authored
Update documentation for #:sdk directive (#48079)
Clarified the explanation of the #:sdk directive and its usage, including the handling of version specification.
1 parent 7b2d793 commit 2e35e21

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/csharp/language-reference/preprocessor-directives.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,18 @@ The `#:` directives that are used in file-based apps include:
6666

6767
- `#:sdk`:
6868

69-
The first instance specifies the value for the `<Project Sdk="value" />` node. Subsequent instances specify the `<Sdk Name="value" Version="version" />` node. The version can be omitted. For example:
69+
The first instance specifies the value for the `<Project Sdk="value" />` node. Subsequent instances specify the `<Sdk Name="value" Version="version" />` node. The version can be omitted (i.e. if specified in global.json or included in .NET SDK). For example:
7070

7171
```csharp
7272
#:sdk Microsoft.NET.Sdk.Web
73+
#:sdk Aspire.AppHost.Sdk@9.4.1
74+
```
75+
76+
The two preceding preprocessors is translated into:
77+
78+
```xml
79+
<Project Sdk="Microsoft.NET.Sdk.Web" />
80+
<Sdk Name="Aspire.AppHost.Sdk" Version="9.4.1" />
7381
```
7482

7583
- `#:property`:

0 commit comments

Comments
 (0)