Skip to content

Commit e86f788

Browse files
CopilotBillWagner
andcommitted
Update Advanced Compiler Settings for modern .NET
Co-authored-by: BillWagner <[email protected]>
1 parent 44c81cb commit e86f788

File tree

1 file changed

+9
-5
lines changed
  • docs/csharp/language-reference/compiler-options

1 file changed

+9
-5
lines changed

docs/csharp/language-reference/compiler-options/advanced.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Advanced C# Compiler Options. These options are used in advanced scenarios."
33
title: "Compiler Options - advanced scenarios"
4-
ms.date: 03/12/2021
4+
ms.date: 12/18/2024
55
f1_keywords:
66
- "cs.build.options"
77
helpviewer_keywords:
@@ -40,7 +40,7 @@ The following options support advanced scenarios. The new MSBuild syntax is show
4040
- **Utf8Output** / `-utf8output`: Output compiler messages in UTF-8 encoding.
4141
- **FileAlignment** / `-filealign`: Specify the alignment used for output file sections.
4242
- **ErrorEndLocation** / `-errorendlocation`: Output line and column of the end location of each error.
43-
- **NoStandardLib** / `-nostdlib`: Don't reference standard library *mscorlib.dll*.
43+
- **NoStandardLib** / `-nostdlib`: Don't reference standard library. (Prevents automatic reference to the .NET Base Class Library - *mscorlib.dll* in .NET Framework projects, *System.Private.CoreLib.dll* in modern .NET projects.)
4444
- **SubsystemVersion** / `-subsystemversion`: Specify subsystem version of this assembly.
4545
- **ModuleAssemblyName** / `-moduleassemblyname`: Name of the assembly that this module will be a part of.
4646
- **ReportIVTs** / `-reportivts`: Produce additional information on <xref:System.Runtime.CompilerServices.InternalsVisibleToAttribute?displayProperty=nameWithType> information.
@@ -226,13 +226,13 @@ By default, the compiler writes the starting location in source for all errors a
226226

227227
## NoStandardLib
228228

229-
**NoStandardLib** prevents the import of mscorlib.dll, which defines the entire System namespace.
229+
**NoStandardLib** prevents the automatic reference to the .NET Base Class Library. In .NET Framework projects, this refers to *mscorlib.dll*, while in modern .NET projects (.NET 5+), this refers to *System.Private.CoreLib.dll*. Both assemblies define the entire System namespace.
230230

231231
```xml
232232
<NoStandardLib>true</NoStandardLib>
233233
```
234234

235-
Use this option if you want to define or create your own System namespace and objects. If you don't specify **NoStandardLib**, mscorlib.dll is imported into your program (same as specifying `<NoStandardLib>false</NoStandardLib>`).
235+
Use this option if you want to define or create your own System namespace and objects. If you don't specify **NoStandardLib**, the appropriate base class library is automatically referenced (same as specifying `<NoStandardLib>false</NoStandardLib>`).
236236

237237
## SubsystemVersion
238238

@@ -256,14 +256,18 @@ The following table lists common subsystem versions of Windows.
256256
|Windows 7|6.01|
257257
|Windows Server 2008|6.01|
258258
|Windows 8|6.02|
259+
|Windows 8.1|6.03|
260+
|Windows 10|6.04|
261+
|Windows 11|6.04|
259262

260263
The default value of the **SubsystemVersion** compiler option depends on the conditions in the following list:
261264

262265
- The default value is 6.02 if any compiler option in the following list is set:
263266
- [-target:appcontainerexe](output.md#outputtype)
264267
- [-target:winmdobj](output.md#outputtype)
265268
- [-platform:arm](output.md#platformtarget)
266-
- The default value is 6.00 if you're using MSBuild, you're targeting .NET Framework 4.5, and you haven't set any of the compiler options that were specified earlier in this list.
269+
- The default value is 6.00 if you're using MSBuild, you're targeting .NET Framework 4.5 or later, and you haven't set any of the compiler options that were specified earlier in this list.
270+
- For modern .NET projects (.NET 5+), the default value is 6.00, which allows your application to run on Windows Vista and later versions.
267271
- The default value is 4.00 if none of the previous conditions are true.
268272

269273
## ModuleAssemblyName

0 commit comments

Comments
 (0)