Skip to content

Commit c268094

Browse files
authored
Update preprocessor directives documentation
Updated the date for the preprocessor directives documentation and added new information about the `#:project` token.
1 parent cb90bb2 commit c268094

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn the different C# preprocessor directives that control conditional compilation, warnings, nullable analysis, and more"
33
title: "Preprocessor directives"
4-
ms.date: 06/19/2025
4+
ms.date: 09/24/2025
55
f1_keywords:
66
- "cs.preprocessor"
77
- "#nullable"
@@ -109,6 +109,20 @@ The `#:` directives that are used in file-based apps include:
109109
```xml
110110
<PackageReference Include="System.CommandLine" Version="2.0.0-*">
111111
```
112+
113+
- `#:project`:
114+
115+
Instance of `#:project` are translated into `ProjectReference` elements to include the project with the specified path to the project. For example:
116+
117+
```csharp
118+
#:project ../Path/To.Example.csproj
119+
```
120+
121+
The preceding preprocessor token is translated into:
122+
123+
```xml
124+
<ProjectReference Include="../Path/To.Example.csproj" />
125+
```
112126

113127
Tools can add new tokens following the `#:` convention.
114128

0 commit comments

Comments
 (0)