From 2f76298ded67caf6532fb7760a97802f2a0547b3 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 19 May 2026 11:31:50 -0400 Subject: [PATCH 1/7] Phase 1: move internal error This diagnostics incidates you found a bug in the compiler. Good job. --- .../language-reference/compiler-messages/index.md | 13 +++++++++---- ...-we-don-t-have-specifics-on-this-csharp-error.md | 9 ++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/csharp/language-reference/compiler-messages/index.md b/docs/csharp/language-reference/compiler-messages/index.md index 0328ceaab8659..eee7e859f4c7e 100644 --- a/docs/csharp/language-reference/compiler-messages/index.md +++ b/docs/csharp/language-reference/compiler-messages/index.md @@ -1,12 +1,11 @@ --- description: "C# Compiler Errors" title: "Compiler messages" -ms.date: 05/21/2024 +ms.date: 05/19/2026 +f1_keywords: + - "CS8751" helpviewer_keywords: - "C# language, compiler errors" - - "Visual C# compiler, errors" - - "errors [C#]" -ms.assetid: 57262ab1-6c50-4f9c-81ad-9fba48477416 --- # C# Compiler Errors @@ -21,6 +20,12 @@ For information about how to configure error and warning options in C#, see [C# [!INCLUDE[note_settings_general](~/includes/note-settings-general-md.md)] +## Internal compiler error (CS8751) + +- **CS8751**: *Internal error in the C# compiler.* + +CS8751 indicates an internal compiler error. Your code exposed a bug in the compiler itself, not in your source code. If you encounter this error, [file an issue in the Roslyn repository](https://github.com/dotnet/roslyn/issues/new/choose) with a minimal reproduction so the compiler team can investigate and fix the problem. + ## See also - [C# Compiler Options](../compiler-options/index.md) diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index 26718f563625d..2ae11c4b9dd4a 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -260,7 +260,6 @@ f1_keywords: - "CS8662" - "CS8669" # C# 9 diagnostics start here - - "CS8751" # misc - "CS8760" # misc - "CS8761" - "CS8771" @@ -282,6 +281,7 @@ f1_keywords: - "CS9358" - "CS9359" # unsafe evolution + - "CS9360" - "CS9360" - "CS9361" - "CS9362" @@ -290,6 +290,8 @@ f1_keywords: - "CS9365" - "CS9366" # More unions: + - "CS9367" + - "CS9368" - "CS9369" - "CS9370" - "CS9371" @@ -304,6 +306,11 @@ f1_keywords: - "CS9378" # More unsafe - "CS9379" + - "CS9380" + - "CS9381" + - "CS9382" + - "CS9383" + - "CS9384" helpviewer_keywords: - "errors [C#], additional information" --- From 31c1282539e975d14b6c408b84bef7f9c61a5189 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 19 May 2026 12:08:22 -0400 Subject: [PATCH 2/7] First pass This assumes a search won't uncover related errors for build configs. --- .../compiler-messages/attribute-usage-errors.md | 15 ++++++++++----- .../compiler-messages/constructor-errors.md | 7 ++++++- .../compiler-messages/index.md | 12 ++++++++++++ .../overloaded-operator-errors.md | 7 ++++++- docs/csharp/language-reference/toc.yml | 16 ++++++++-------- ...-don-t-have-specifics-on-this-csharp-error.md | 6 ------ 6 files changed, 42 insertions(+), 21 deletions(-) diff --git a/docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md b/docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md index 174e446cbbad9..358e6c40aff86 100644 --- a/docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md +++ b/docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md @@ -44,6 +44,7 @@ f1_keywords: - "CS8962" - "CS8963" - "CS8968" + - "CS8783" - "CS8970" - "CS9331" helpviewer_keywords: @@ -89,9 +90,10 @@ helpviewer_keywords: - "CS8962" - "CS8963" - "CS8968" + - "CS8783" - "CS8970" - "CS9331" -ms.date: 02/13/2026 +ms.date: 05/19/2026 ai-usage: ai-assisted --- # Resolve errors and warnings related to attribute declarations or attribute use in your code @@ -143,6 +145,7 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS8962**](#callerargumentexpression-attribute-usage): *The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is overridden by the CallerMemberNameAttribute.* - [**CS8963**](#callerargumentexpression-attribute-usage): *The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is applied with an invalid parameter name.* - [**CS8968**](#attribute-arguments-and-parameters): *An attribute type argument cannot use type parameters* +- [**CS8783**](#conditional-attribute-usage): *Local function 'method' must be 'static' in order to use the Conditional attribute* - [**CS8970**](#attribute-arguments-and-parameters): *Type cannot be used in this context because it cannot be represented in metadata.* - [**CS9331**](#predefined-attributes): *Attribute cannot be applied manually.* @@ -234,16 +237,16 @@ The following errors occur when you use specific predefined .NET attributes inco To correct these errors, follow these rules. For more information, see [Indexers](../../programming-guide/indexers/index.md), [Structure types](../builtin-types/struct.md), , and [Platform Invoke (P/Invoke)](../../../standard/native-interop/pinvoke.md). -- The can only be applied to indexers that aren't explicit interface member declarations (**CS0415**). Remove the attribute from explicit interface indexers, because the interface already defines the indexer name. +- You can apply only to indexers that aren't explicit interface member declarations (**CS0415**). Remove the attribute from explicit interface indexers, because the interface already defines the indexer name. - You can't apply `IndexerName` to indexers marked with `override` because override indexers inherit their name from the base class (**CS0609**). Remove the `IndexerName` attribute from the override indexer. - Every instance field in a type marked with `StructLayout(LayoutKind.Explicit)` must have a (**CS0625**). Explicit layout requires that you specify the byte offset for each instance field. -- The can only be placed on members of types that have set to `LayoutKind.Explicit` (**CS0636**). Add the `StructLayout` attribute to the containing type declaration. +- You can place the only on members of types that have set to `LayoutKind.Explicit` (**CS0636**). Add the `StructLayout` attribute to the containing type declaration. - The `FieldOffset` attribute isn't allowed on `static` or `const` fields because explicit layout applies only to instance fields (**CS0637**). Remove the `FieldOffset` attribute from the static or const field. - You can't apply to a type that already contains an indexer because the compiler automatically defines the default member for types with indexers (**CS0646**). Remove the `DefaultMember` attribute. - All attributes within a type must specify the same name (**CS0668**). Change the names to match, because the runtime uses a single name for all indexers on a type. -- The type specified as an argument for must be a non-generic, non-nested, non-pointer, non-array type (**CS0735**). Only top-level named types are valid forwarding targets. +- You must specify a non-generic, non-nested, non-pointer, non-array type as an argument for (**CS0735**). Only top-level named types are valid forwarding targets. - An assembly can have only one for each external type (**CS0739**). Locate and remove the duplicate `TypeForwardedTo` declaration. -- The isn't permitted on types defined in C# (**CS1608**). This attribute is reserved for other languages that need to force compilers to require a particular feature. +- You can't use the on types defined in C# (**CS1608**). This attribute is reserved for other languages that need to force compilers to require a particular feature. - Some attributes are reserved for the compiler and can't be applied manually in source code (**CS9331**). Replace the attribute with the equivalent C# language syntax that causes the compiler to generate it. ## Conditional attribute usage @@ -258,6 +261,7 @@ You see the following errors when you apply the , [Conditional methods](~/_csharpstandard/standard/attributes.md#23532-conditional-methods), and [Attributes](../../advanced-topics/reflection-and-attributes/index.md). @@ -269,6 +273,7 @@ To correct these errors, follow these rules. For more information, see [!IMPORTANT] > The signature requirements for static binary operators and the corresponding instance compound assignment operators are different. Make sure the signature matches the declaration you want. diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index 1d6403142551f..d11b2a2d8413c 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -475,8 +475,8 @@ items: CS0181, CS0243, CS0404, CS0415, CS0416, CS0447, CS0577, CS0578, CS0579, CS0582, CS0592, CS0609, CS0616, CS0625, CS0629, CS0636, CS0637, CS0641, CS0646, CS0647, CS0653, CS0657, CS0658, CS0668, CS0685, CS0735, CS0739, CS1608, CS1614, CS1618, - CS1667, CS1689, CS7014, CS7046, CS7047, CS7067, CS8959, CS8960, CS8961, CS8962, - CS8963, CS8968, CS8970, CS9331 + CS1667, CS1689, CS7014, CS7046, CS7047, CS7067, CS8783, CS8959, CS8960, CS8961, + CS8962, CS8963, CS8968, CS8970, CS9331 - name: Feature or version missing href: ./compiler-messages/feature-version-errors.md displayName: > @@ -514,11 +514,11 @@ items: displayName: > Primary constructors, module initializers, UnmanagedCallersOnly, CS0132, CS0514, CS0515, CS0516, CS0517, CS0522, CS0526, CS0568, CS0573, CS0710, - CS0768, CS0824, CS1018, CS8054, CS8091, CS8358, CS8813, CS8814, CS8815, CS8816, - CS8862, CS8867, CS8868, CS8878, CS8900, CS8901, CS8902, CS8910, CS8958, CS8982, - CS8983, CS9018, CS9019, CS9020, CS9021, CS9022, CS9105, CS9106, CS9107, CS9108, - CS9109, CS9110, CS9111, CS9112, CS9113, CS9114, CS9115, CS9116, CS9117, CS9118, - CS9119, CS9120, CS9121, CS9122, CS9124, CS9136, CS9179 + CS0768, CS0824, CS1018, CS8054, CS8091, CS8358, CS8760, CS8813, CS8814, CS8815, + CS8816, CS8862, CS8867, CS8868, CS8878, CS8900, CS8901, CS8902, CS8910, CS8958, + CS8982, CS8983, CS9018, CS9019, CS9020, CS9021, CS9022, CS9105, CS9106, CS9107, + CS9108, CS9109, CS9110, CS9111, CS9112, CS9113, CS9114, CS9115, CS9116, CS9117, + CS9118, CS9119, CS9120, CS9121, CS9122, CS9124, CS9136, CS9179 - name: Property declarations href: ./compiler-messages/property-declaration-errors.md displayName: > @@ -537,7 +537,7 @@ items: CS0031, CS0056, CS0057, CS0215, CS0216, CS0217, CS0218, CS0220, CS0221, CS0448, CS0463, CS0543, CS0552, CS0553, CS0554, CS0555, CS0556, CS0557, CS0558, CS0559, CS0562, CS0563, CS0564, CS0567, CS0590, CS0594, CS0652, CS0659, CS0660, CS0661, - CS0715, CS1021, CS1037, CS1553, CS8778, CS8973, CS9023, CS9024, CS9025, + CS0715, CS1021, CS1037, CS1553, CS8761, CS8778, CS8973, CS9023, CS9024, CS9025, CS9027, CS9308, CS9310, CS9311, CS9312, CS9313, CS9340, CS9341, CS9342 - name: Parameter / argument mismatch href: ./compiler-messages/parameter-argument-mismatch.md diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index 2ae11c4b9dd4a..9e0c24ce6aea2 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -259,12 +259,6 @@ f1_keywords: - "CS8656" - "CS8662" - "CS8669" - # C# 9 diagnostics start here - - "CS8760" # misc - - "CS8761" - - "CS8771" - - "CS8772" - - "CS8783" # local function # Coming in C# 15 - "CS9343" # misc - "CS9347" From 1c2d88a78e447e1a20b23c949f9c15cc0caccb0c Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 19 May 2026 13:24:50 -0400 Subject: [PATCH 3/7] Move command line diagnostics I don't want the index.md to be a catch-all, so create a speciic file for command line options and build config issues. This created more opportunities for consolidation. --- .../compiler-messages/index.md | 20 ------- .../invalid-build-command-line.md | 57 +++++++++++++++++++ docs/csharp/language-reference/toc.yml | 6 ++ ...n-t-have-specifics-on-this-csharp-error.md | 11 ---- 4 files changed, 63 insertions(+), 31 deletions(-) create mode 100644 docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md diff --git a/docs/csharp/language-reference/compiler-messages/index.md b/docs/csharp/language-reference/compiler-messages/index.md index 2c3dfc737f476..b56003a414edb 100644 --- a/docs/csharp/language-reference/compiler-messages/index.md +++ b/docs/csharp/language-reference/compiler-messages/index.md @@ -2,10 +2,6 @@ description: "C# Compiler Errors" title: "Compiler messages" ms.date: 05/19/2026 -f1_keywords: - - "CS8751" - - "CS8771" - - "CS8772" helpviewer_keywords: - "C# language, compiler errors" --- @@ -22,22 +18,6 @@ For information about how to configure error and warning options in C#, see [C# [!INCLUDE[note_settings_general](~/includes/note-settings-general-md.md)] -## Internal compiler error (CS8751) - -- **CS8751**: *Internal error in the C# compiler.* - -CS8751 indicates an internal compiler error. Your code exposed a bug in the compiler itself, not in your source code. If you encounter this error, [file an issue in the Roslyn repository](https://github.com/dotnet/roslyn/issues/new/choose) with a minimal reproduction so the compiler team can investigate and fix the problem. - -## Command-line errors (CS8771, CS8772) - -- **CS8771**: *Output directory could not be determined* -- **CS8772**: *stdin argument '-' is specified, but input has not been redirected from the standard input stream.* - -These errors indicate problems with compiler invocation rather than source code issues. - -- Ensure the project or command line specifies a valid output directory (**CS8771**). This error typically occurs when the build system can't resolve the output path. Verify the `OutputPath` or `OutDir` property in your project file, or pass a valid `/out:` argument to the compiler. -- Redirect standard input when using the `-` (stdin) argument (**CS8772**). The compiler expects piped input when you pass `-` as the source file argument. Use a pipeline (for example, `cat file.cs | csc -`) or remove the `-` argument and pass the source file directly. - ## See also - [C# Compiler Options](../compiler-options/index.md) diff --git a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md new file mode 100644 index 0000000000000..7c4179f0ccbe1 --- /dev/null +++ b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md @@ -0,0 +1,57 @@ +--- +title: "Resolve errors and warnings related to invalid command-line options and build configuration" +description: "This article helps you diagnose and correct compiler errors and warnings related to invalid command-line switches, build configuration, and compiler invocation problems" +f1_keywords: + - "CS1773" + - "CS2038" + - "CS2039" + - "CS2040" + - "CS2041" + - "CS2042" + - "CS2043" + - "CS2044" + - "CS2045" + - "CS2046" + - "CS7038" + - "CS8751" + - "CS8771" + - "CS8772" +helpviewer_keywords: + - "CS1773" + - "CS2038" + - "CS2039" + - "CS2040" + - "CS2041" + - "CS2042" + - "CS2043" + - "CS2044" + - "CS2045" + - "CS2046" + - "CS7038" + - "CS8751" + - "CS8771" + - "CS8772" +ms.date: 05/19/2026 +ai-usage: ai-assisted +--- +# Resolve errors and warnings for invalid command-line options and build configuration + +This article covers the following compiler errors and warnings: + + +- [**CS1773**](#anchor-tbd): *Invalid version 'version' for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise* +- [**CS2038**](#anchor-tbd): *The language name 'name' is invalid.* +- [**CS2039**](#anchor-tbd): *Command-line syntax error: Invalid Guid format 'value' for option 'option'* +- [**CS2040**](#anchor-tbd): *Command-line syntax error: Missing Guid for option 'option'* +- [**CS2041**](#anchor-tbd): *Invalid output name: 'name'* +- [**CS2042**](#anchor-tbd): *Invalid debug information format: 'format'* +- [**CS2043**](#anchor-tbd): *'id#' syntax is no longer supported. Use '$id' instead.* +- [**CS2044**](#anchor-tbd): */sourcelink switch is only supported when emitting PDB.* +- [**CS2045**](#anchor-tbd): */embed switch is only supported when emitting a PDB.* +- [**CS2046**](#anchor-tbd): *Command-line syntax error: 'value' is not a valid value for the 'option' option. The value must be of the form 'format'.* +- [**CS7038**](#anchor-tbd): *Failed to emit module 'module': 'error'* +- [**CS8751**](#anchor-tbd): *Internal error in the C# compiler.* +- [**CS8771**](#anchor-tbd): *Output directory could not be determined* +- [**CS8772**](#anchor-tbd): *stdin argument '-' is specified, but input has not been redirected from the standard input stream.* diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index d11b2a2d8413c..786467d0e24d3 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -463,6 +463,12 @@ items: - name: C# compiler messages href: ./compiler-messages/index.md items: + - name: Invalid command-line options + href: ./compiler-messages/invalid-build-command-line.md + displayName: > + command line, build configuration, compiler invocation, + CS1773, CS2038, CS2039, CS2040, CS2041, CS2042, CS2043, CS2044, CS2045, CS2046, + CS7038, CS8751, CS8771, CS8772 - name: Preprocessor errors href: ./compiler-messages/preprocessor-errors.md displayName: > diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index 9e0c24ce6aea2..a5b894ad8be53 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -31,20 +31,10 @@ f1_keywords: - "CS1768" - "CS1769" - "CS1770" - - "CS1773" - "CS1774" - "CS1982" - "CS1996" - "CS1997" - - "CS2038" - - "CS2039" - - "CS2040" - - "CS2041" - - "CS2042" - - "CS2043" - - "CS2044" - - "CS2045" - - "CS2046" - "CS3028" # C# 5 diagnostics - "CS4017" @@ -78,7 +68,6 @@ f1_keywords: - "CS7033" - "CS7034" - "CS7035" - - "CS7038" # build only diagnostic - "CS7041" - "CS7042" - "CS7043" From d3de3ce62d4d2d240f6180fc6e5f02b4bdf08c5a Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 19 May 2026 14:39:52 -0400 Subject: [PATCH 4/7] consolidate existing diagnostics Several existing diagnostics were consolidated around the theme of invalid build configurations. --- .openpublishing.redirection.csharp.json | 56 +++++++ .../compiler-messages/cs0006.md | 15 -- .../compiler-messages/cs0007.md | 17 -- .../compiler-messages/cs0016.md | 15 -- .../compiler-messages/cs1564.md | 42 ----- .../compiler-messages/cs1616.md | 39 ----- .../compiler-messages/cs2032.md | 35 ---- .../invalid-build-command-line.md | 151 ++++++++++++++++++ docs/csharp/language-reference/toc.yml | 35 +--- docs/csharp/misc/cs1668.md | 20 --- docs/csharp/misc/cs1719.md | 15 -- docs/csharp/misc/cs2008.md | 15 -- docs/csharp/misc/cs2019.md | 26 --- docs/csharp/misc/cs2029.md | 17 -- docs/csharp/misc/cs2036.md | 43 ----- docs/csharp/misc/cs3012.md | 33 ---- docs/csharp/misc/cs3013.md | 17 -- 17 files changed, 211 insertions(+), 380 deletions(-) delete mode 100644 docs/csharp/language-reference/compiler-messages/cs0006.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs0007.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs0016.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs1564.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs1616.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs2032.md delete mode 100644 docs/csharp/misc/cs1668.md delete mode 100644 docs/csharp/misc/cs1719.md delete mode 100644 docs/csharp/misc/cs2008.md delete mode 100644 docs/csharp/misc/cs2019.md delete mode 100644 docs/csharp/misc/cs2029.md delete mode 100644 docs/csharp/misc/cs2036.md delete mode 100644 docs/csharp/misc/cs3012.md delete mode 100644 docs/csharp/misc/cs3013.md diff --git a/.openpublishing.redirection.csharp.json b/.openpublishing.redirection.csharp.json index d16707f3655de..810c4fa5adde5 100644 --- a/.openpublishing.redirection.csharp.json +++ b/.openpublishing.redirection.csharp.json @@ -8,10 +8,34 @@ "source_path_from_root": "/docs/csharp/fundamentals/types/namespaces.md", "redirect_url": "/dotnet/csharp/fundamentals/program-structure/namespaces" }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0006.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0007.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0016.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1564.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1616.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, { "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1763.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/generic-type-parameters-errors" }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs2032.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, { "source_path_from_root": "/docs/csharp/misc/cs0017.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/entry-point-errors" @@ -336,10 +360,18 @@ "source_path_from_root": "/docs/csharp/misc/cs1638.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/feature-version-errors" }, + { + "source_path_from_root": "/docs/csharp/misc/cs1668.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, { "source_path_from_root": "/docs/csharp/misc/cs1715.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/property-declaration-errors" }, + { + "source_path_from_root": "/docs/csharp/misc/cs1719.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, { "source_path_from_root": "/docs/csharp/misc/cs1720.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/generic-type-parameters-errors" @@ -352,10 +384,34 @@ "source_path_from_root": "/docs/csharp/misc/cs1958.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/delegate-function-pointer-diagnostics" }, + { + "source_path_from_root": "/docs/csharp/misc/cs2008.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, { "source_path_from_root": "/docs/csharp/misc/cs2017.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/entry-point-errors" }, + { + "source_path_from_root": "/docs/csharp/misc/cs2019.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs2029.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs2036.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs3012.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs3013.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/invalid-build-command-line" + }, { "source_path_from_root": "/docs/csharp/misc/cs3024.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/generic-type-parameters-errors" diff --git a/docs/csharp/language-reference/compiler-messages/cs0006.md b/docs/csharp/language-reference/compiler-messages/cs0006.md deleted file mode 100644 index 7f8286af30d19..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs0006.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -description: "Compiler Error CS0006" -title: "Compiler Error CS0006" -ms.date: 07/20/2015 -f1_keywords: - - "CS0006" -helpviewer_keywords: - - "CS0006" -ms.assetid: fe029a0e-d85a-4d8e-8a46-01f6120092fe ---- -# Compiler Error CS0006 - -Metadata file 'dll_name' could not be found - - The program was compiled and explicitly passed the name of a file that contained metadata; however, the .dll was not found. For more information, see [**References** (C# Compiler Options)](../compiler-options/inputs.md#references). diff --git a/docs/csharp/language-reference/compiler-messages/cs0007.md b/docs/csharp/language-reference/compiler-messages/cs0007.md deleted file mode 100644 index 75d578cf11797..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs0007.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: "Compiler Error CS0007" -title: "Compiler Error CS0007" -ms.date: 07/20/2015 -f1_keywords: - - "CS0007" -helpviewer_keywords: - - "CS0007" -ms.assetid: d65849cf-2713-454a-b928-3c8aa8fc993e ---- -# Compiler Error CS0007 - -Unexpected common language runtime initialization error — 'description' - - This error occurs if the runtime could not be loaded. This could occur if the version of the common language runtime that the compiler attempts to load is not present on the machine, or if the common language runtime installation or configuration is corrupt. - - This can happen if the *csc.exe.config* file was changed. This file is configured during setup and should not be changed. If there is a possibility that the *csc.exe.config* file was changed, check the file to make sure that the version of the runtime specified in the file is present on the machine. If the correct version is present, it may be corrupted. Reinstall the common language runtime. diff --git a/docs/csharp/language-reference/compiler-messages/cs0016.md b/docs/csharp/language-reference/compiler-messages/cs0016.md deleted file mode 100644 index 9e7ec96071115..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs0016.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -description: "Compiler Error CS0016" -title: "Compiler Error CS0016" -ms.date: 07/20/2015 -f1_keywords: - - "CS0016" -helpviewer_keywords: - - "CS0016" -ms.assetid: da62084c-7a18-4858-9034-d1fe099bf34c ---- -# Compiler Error CS0016 - -Could not write to output file 'file' — 'reason' - - The compiler could not write to an output file. Check the path to the file to make sure it exists. If a previously built file is already at the location, make sure it is writeable, and that no process currently has a lock on the file. For example, make sure your executable is not running when you attempt to build. diff --git a/docs/csharp/language-reference/compiler-messages/cs1564.md b/docs/csharp/language-reference/compiler-messages/cs1564.md deleted file mode 100644 index 115ce0b6930d8..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1564.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -description: "Compiler Error CS1564" -title: "Compiler Error CS1564" -ms.date: 07/20/2015 -f1_keywords: - - "CS1564" -helpviewer_keywords: - - "CS1564" -ms.assetid: 32206075-a14b-4c24-bd78-257104078f83 ---- -# Compiler Error CS1564 - -Conflicting options specified: Win32 resource file; Win32 manifest. - - If you use the **/Win32res** compiler option, you must include the custom Win32 manifest (if it is required) in the resource file. You cannot provide a custom Win32 manifest separately from a Win32 resource file. Use the **/win32manifest** option only if you are not specifying a win32 resource file. - -## To correct this error - -1. Add the win32 manifest to the win32 resource file and remove the **/win32manifest** compiler option. - -## Example - - The following example produces CS1564 if it is compiled with the **/Win32res** option and no manifest is included in the resource file. - -```csharp -// cs1564.cs -// Compile with: /Win32res -public class Test -{ - static int Main(string[] args) - { - return 1; - } -} -``` - - The C# 3.0 compiler adds a default win32Manifest to all binaries. - -## See also - -- [**Win32Manifest** (C# Compiler Options)](../compiler-options/resources.md#win32manifest) -- [**Win32Resource** (C# Compiler Options)](../compiler-options/resources.md#win32resource) diff --git a/docs/csharp/language-reference/compiler-messages/cs1616.md b/docs/csharp/language-reference/compiler-messages/cs1616.md deleted file mode 100644 index e0861e0b7e35b..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1616.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -description: "Compiler Warning (level 1) CS1616" -title: "Compiler Warning (level 1) CS1616" -ms.date: 07/20/2015 -f1_keywords: - - "CS1616" -helpviewer_keywords: - - "CS1616" -ms.assetid: 7fb99eba-8da3-4c1b-81a3-bc4a57822e45 ---- -# Compiler Warning (level 1) CS1616 - -Option 'option' overrides attribute 'attribute' given in a source file or added module - - This warning occurs if the assembly attributes or found in source conflict with the [**KeyFile**](../compiler-options/security.md#keyfile) or [**KeyContainer**](../compiler-options/security.md#keycontainer) command line option or key file name or key container specified in the Project Properties. - - For the example below, assume you have a key file named `cs1616.snk`. Generate this file with the command line: - -```console -sn -k CS1616.snk -``` - - The following sample generates CS1616: - -```csharp -// CS1616.cs -// compile with: /keyfile:cs1616.snk -using System.Reflection; - -// To fix the error, remove the next line -[assembly: AssemblyKeyFile("cs1616b.snk")] // CS1616 - -class C -{ - public static void Main() - { - } -} -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs2032.md b/docs/csharp/language-reference/compiler-messages/cs2032.md deleted file mode 100644 index 41770554543ea..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs2032.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: "Compiler Error CS2032" -title: "Compiler Error CS2032" -ms.date: 07/20/2015 -f1_keywords: - - "CS2032" -helpviewer_keywords: - - "CS2032" -ms.assetid: 534e2d2f-d209-43dd-abc9-e5ea5b01efc4 ---- -# Compiler Error CS2032 - -Character 'character' is not allowed on the command-line or in response files - - Response files and the command line options for csc.exe cannot contain ASCII control characters in the range 0-31 or the pipe (`|`) character. - - Compiler error CS2032 is difficult to demonstrate from the command line because the command line processor and the integrated development environment (IDE) filter out characters that are not valid. The following procedure generates the error by using a [response file](../compiler-options/miscellaneous.md#responsefiles). - -## To generate this error - -1. In the *My Documents* folder, create a text file that is named *CS2032.rsp*, and then enter the following compiler options in it: - - ```console - /target:exe /out:cs|2032.exe cs2032.cs - ``` - -2. In the *My Documents* folder, create a text file that's named *cs2032.cs* and that contains whatever you want. - -3. Open [Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell](/visualstudio/ide/reference/command-prompt-powershell). - -4. Change the current directory to `C:\Users\\\Documents`. - -5. Run the following command from the command prompt: `csc @cs2032.rsp` - -6. The CS2032 error message appears because the response file, *CS2032.rsp*, contains a pipe character. diff --git a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md index 7c4179f0ccbe1..beefb16e13e0b 100644 --- a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md +++ b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md @@ -2,7 +2,19 @@ title: "Resolve errors and warnings related to invalid command-line options and build configuration" description: "This article helps you diagnose and correct compiler errors and warnings related to invalid command-line switches, build configuration, and compiler invocation problems" f1_keywords: + - "CS0006" + - "CS0007" + - "CS0016" + - "CS1564" + - "CS1616" + - "CS1668" + - "CS1719" - "CS1773" + - "CS2008" + - "CS2019" + - "CS2029" + - "CS2032" + - "CS2036" - "CS2038" - "CS2039" - "CS2040" @@ -12,12 +24,26 @@ f1_keywords: - "CS2044" - "CS2045" - "CS2046" + - "CS3012" + - "CS3013" - "CS7038" - "CS8751" - "CS8771" - "CS8772" helpviewer_keywords: + - "CS0006" + - "CS0007" + - "CS0016" + - "CS1564" + - "CS1616" + - "CS1668" + - "CS1719" - "CS1773" + - "CS2008" + - "CS2019" + - "CS2029" + - "CS2032" + - "CS2036" - "CS2038" - "CS2039" - "CS2040" @@ -27,6 +53,8 @@ helpviewer_keywords: - "CS2044" - "CS2045" - "CS2046" + - "CS3012" + - "CS3013" - "CS7038" - "CS8751" - "CS8771" @@ -41,7 +69,19 @@ This article covers the following compiler errors and warnings: +- [**CS0006**](#anchor-tbd): *Metadata file 'file' could not be found* +- [**CS0007**](#anchor-tbd): *Unexpected common language runtime initialization error — 'description'* +- [**CS0016**](#anchor-tbd): *Could not write to output file 'file' -- 'reason'* +- [**CS1564**](#anchor-tbd): *Conflicting options specified: Win32 resource file; Win32 manifest* +- [**CS1616**](#anchor-tbd): *Option 'option' overrides attribute 'attribute' given in a source file or added module* +- [**CS1668**](#anchor-tbd): *Invalid search path 'path' specified in 'option' -- 'reason'* +- [**CS1719**](#anchor-tbd): *Error opening Win32 resource file 'file' -- 'reason'* - [**CS1773**](#anchor-tbd): *Invalid version 'version' for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise* +- [**CS2008**](#anchor-tbd): *No source files specified.* +- [**CS2019**](#anchor-tbd): *Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'* +- [**CS2029**](#anchor-tbd): *Invalid name for a preprocessing symbol; 'identifier' is not a valid identifier* +- [**CS2032**](#anchor-tbd): *Character 'character' is not allowed on the command-line or in response files* +- [**CS2036**](#anchor-tbd): *The /pdb option requires that the /debug option also be used* - [**CS2038**](#anchor-tbd): *The language name 'name' is invalid.* - [**CS2039**](#anchor-tbd): *Command-line syntax error: Invalid Guid format 'value' for option 'option'* - [**CS2040**](#anchor-tbd): *Command-line syntax error: Missing Guid for option 'option'* @@ -51,7 +91,118 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS2044**](#anchor-tbd): */sourcelink switch is only supported when emitting PDB.* - [**CS2045**](#anchor-tbd): */embed switch is only supported when emitting a PDB.* - [**CS2046**](#anchor-tbd): *Command-line syntax error: 'value' is not a valid value for the 'option' option. The value must be of the form 'format'.* +- [**CS3012**](#anchor-tbd): *You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking* +- [**CS3013**](#anchor-tbd): *Added modules must be marked with the CLSCompliant attribute to match the assembly* - [**CS7038**](#anchor-tbd): *Failed to emit module 'module': 'error'* - [**CS8751**](#anchor-tbd): *Internal error in the C# compiler.* - [**CS8771**](#anchor-tbd): *Output directory could not be determined* - [**CS8772**](#anchor-tbd): *stdin argument '-' is specified, but input has not been redirected from the standard input stream.* + +## CS0006 + +Metadata file 'dll_name' could not be found. + +The program was compiled and explicitly passed the name of a file that contained metadata; however, the .dll was not found. For more information, see [**References** (C# Compiler Options)](../compiler-options/inputs.md#references). + +## CS0007 + +Unexpected common language runtime initialization error — 'description'. + +This error occurs if the runtime could not be loaded. This could occur if the version of the common language runtime that the compiler attempts to load is not present on the machine, or if the common language runtime installation or configuration is corrupt. + +This can happen if the *csc.exe.config* file was changed. This file is configured during setup and should not be changed. If there is a possibility that the *csc.exe.config* file was changed, check the file to make sure that the version of the runtime specified in the file is present on the machine. If the correct version is present, it may be corrupted. Reinstall the common language runtime. + +## CS0016 + +Could not write to output file 'file' — 'reason'. + +The compiler could not write to an output file. Check the path to the file to make sure it exists. If a previously built file is already at the location, make sure it is writeable, and that no process currently has a lock on the file. For example, make sure your executable is not running when you attempt to build. + +## CS1564 + +Conflicting options specified: Win32 resource file; Win32 manifest. + +If you use the **/Win32res** compiler option, you must include the custom Win32 manifest (if it is required) in the resource file. You cannot provide a custom Win32 manifest separately from a Win32 resource file. Use the **/win32manifest** option only if you are not specifying a win32 resource file. + +To correct this error, add the win32 manifest to the win32 resource file and remove the **/win32manifest** compiler option. + +For more information, see [**Win32Manifest** (C# Compiler Options)](../compiler-options/resources.md#win32manifest) and [**Win32Resource** (C# Compiler Options)](../compiler-options/resources.md#win32resource). + +## CS1616 + +Option 'option' overrides attribute 'attribute' given in a source file or added module. + +This warning occurs if the assembly attributes or found in source conflict with the [**KeyFile**](../compiler-options/security.md#keyfile) or [**KeyContainer**](../compiler-options/security.md#keycontainer) command line option or key file name or key container specified in the Project Properties. + +To resolve this warning, remove the conflicting source attribute or remove the conflicting command-line option so they don't contradict each other. + +## CS1668 + +Invalid search path 'path' specified in 'option' -- 'reason'. + +The path supplied to [**AdditionalLibPaths**](../compiler-options/advanced.md#additionallibpaths) at the command line was not valid, or a path in the LIB environment variable is invalid. Check the path used to verify that it exists and can be accessed. The error message in single quotation marks is the error returned from the operating system. + +## CS1719 + +Error opening Win32 resource file 'File Name' -- 'reason'. + +An attempt to read the Win32 resource file failed for the reason given in the error, typically something like "file not found" or "access denied." This error is resolved by correcting the problem described by the reason. + +## CS2008 + +No source files specified. + +The compiler was invoked and compiler options were specified, but no source-code files were passed. + +## CS2019 + +Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'. + +The [**OutputType**](../compiler-options/output.md#outputtype) compiler option was used, but an invalid parameter was passed. To resolve this error, recompile the program using the form of the **/target** option that is appropriate to your output file. + +## CS2029 + +Invalid value for '/define'; 'identifier' is not a valid identifier. + +This warning occurs if the value that is used in the [**DefineConstants**](../compiler-options/language.md#defineconstants) option has some invalid characters. + +This warning cannot be suppressed by the [**NoWarn**](../compiler-options/errors-warnings.md#nowarn) option. + +## CS2032 + +Character 'character' is not allowed on the command-line or in response files. + +Response files and the command line options for csc.exe cannot contain ASCII control characters in the range 0-31 or the pipe (`|`) character. + +Compiler error CS2032 is difficult to demonstrate from the command line because the command line processor and the integrated development environment (IDE) filter out characters that are not valid. The following procedure generates the error by using a [response file](../compiler-options/miscellaneous.md#responsefiles). + +1. In the *My Documents* folder, create a text file that is named *CS2032.rsp*, and then enter the following compiler options in it: `/target:exe /out:cs|2032.exe cs2032.cs` +2. In the *My Documents* folder, create a text file that's named *cs2032.cs* and that contains whatever you want. +3. Open [Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell](/visualstudio/ide/reference/command-prompt-powershell). +4. Change the current directory to `C:\Users\\Documents`. +5. Run the following command from the command prompt: `csc @cs2032.rsp` +6. The CS2032 error message appears because the response file, *CS2032.rsp*, contains a pipe character. + +## CS2036 + +The /pdb option requires that the /debug option also be used. + +Program database files are only generated for debug builds. The **/pdb** option is therefore meaningless in a retail build. + +To correct this error, add the **/debug** compiler option, or remove the **/pdb** compiler option. + +For more information, see [**PdbFile** (C# Compiler Options)](../compiler-options/advanced.md#pdbfile) and [**DebugType** (C# Compiler Options)](../compiler-options/code-generation.md#debugtype). + +## CS3012 + +You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly. + +In order for a module to be compliant with the Common Language Specification (CLS) through `[module:System.CLSCompliant(true)]`, it must be built with the **module** element of the [**OutputType**](../compiler-options/output.md#outputtype) compiler option. For more information on the CLS, see [Language independence and language-independent components](../../../../standard/language-independence.md). + +## CS3013 + +Added modules must be marked with the CLSCompliant attribute to match the assembly. + +A module that was compiled with the **module** element of the [**OutputType**](../compiler-options/output.md#outputtype) compiler option was added to a compilation with [**AddModule**](../compiler-options/inputs.md#addmodules). However, the module's compliance with the Common Language Specification (CLS) does not agree with the CLS state of the current compilation. + +CLS compliance is indicated with the module attribute. For example, `[module:CLSCompliant(true)]` indicates that the module is CLS compliant, and `[module:CLSCompliant(false)]` indicates that the module is not CLS compliant. The default is `[module:CLSCompliant(false)]`. For more information on the CLS, see [Language independence and language-independent components](../../../../standard/language-independence.md). diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index 786467d0e24d3..29fb29f941bae 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -466,9 +466,10 @@ items: - name: Invalid command-line options href: ./compiler-messages/invalid-build-command-line.md displayName: > - command line, build configuration, compiler invocation, - CS1773, CS2038, CS2039, CS2040, CS2041, CS2042, CS2043, CS2044, CS2045, CS2046, - CS7038, CS8751, CS8771, CS8772 + command line, msbuild, dotnet build, csc, + CS0006, CS0007, CS0016, CS1564, CS1616, CS1668, CS1719, CS1773, CS2008, CS2019, + CS2029, CS2032, CS2036, CS2038, CS2039, CS2040, CS2041, CS2042, CS2043, CS2044, + CS2045, CS2046, CS3012, CS3013, CS7038, CS8751, CS8771, CS8772 - name: Preprocessor errors href: ./compiler-messages/preprocessor-errors.md displayName: > @@ -764,10 +765,6 @@ items: href: ../misc/cs0004.md - name: CS0005 href: ../misc/cs0005.md - - name: CS0006 - href: ./compiler-messages/cs0006.md - - name: CS0007 - href: ./compiler-messages/cs0007.md - name: CS0008 href: ../misc/cs0008.md - name: CS0009 @@ -782,8 +779,6 @@ items: href: ../misc/cs0014.md - name: CS0015 href: ./compiler-messages/cs0015.md - - name: CS0016 - href: ./compiler-messages/cs0016.md - name: CS0019 href: ./compiler-messages/cs0019.md - name: CS0020 @@ -1370,8 +1365,6 @@ items: href: ../misc/cs1562.md - name: CS1563 href: ../misc/cs1563.md - - name: CS1564 - href: ./compiler-messages/cs1564.md - name: CS1565 href: ../misc/cs1565.md - name: CS1566 @@ -1450,8 +1443,6 @@ items: href: ./compiler-messages/cs1705.md - name: CS1713 href: ../misc/cs1713.md - - name: CS1719 - href: ../misc/cs1719.md - name: CS1721 href: ./compiler-messages/cs1721.md - name: CS1722 @@ -1546,8 +1537,6 @@ items: href: ../misc/cs2006.md - name: CS2007 href: ../misc/cs2007.md - - name: CS2008 - href: ../misc/cs2008.md - name: CS2011 href: ../misc/cs2011.md - name: CS2012 @@ -1560,8 +1549,6 @@ items: href: ../misc/cs2016.md - name: CS2018 href: ../misc/cs2018.md - - name: CS2019 - href: ../misc/cs2019.md - name: CS2020 href: ../misc/cs2020.md - name: CS2021 @@ -1570,14 +1557,10 @@ items: href: ../misc/cs2022.md - name: CS2024 href: ../misc/cs2024.md - - name: CS2032 - href: ./compiler-messages/cs2032.md - name: CS2033 href: ../misc/cs2033.md - name: CS2035 href: ../misc/cs2035.md - - name: CS2036 - href: ../misc/cs2036.md - name: CS7003 href: ./compiler-messages/cs7003.md - name: CS8070 @@ -1720,8 +1703,6 @@ items: href: ./compiler-messages/cs1598.md - name: CS1607 href: ./compiler-messages/cs1607.md - - name: CS1616 - href: ./compiler-messages/cs1616.md - name: CS1645 href: ../misc/cs1645.md - name: CS1658 @@ -1756,8 +1737,6 @@ items: href: ../misc/cs2014.md - name: CS2023 href: ../misc/cs2023.md - - name: CS2029 - href: ../misc/cs2029.md - name: CS3000 href: ../misc/cs3000.md - name: CS3001 @@ -1778,10 +1757,6 @@ items: href: ../misc/cs3010.md - name: CS3011 href: ../misc/cs3011.md - - name: CS3012 - href: ../misc/cs3012.md - - name: CS3013 - href: ../misc/cs3013.md - name: CS3014 href: ../misc/cs3014.md - name: CS3015 @@ -1838,8 +1813,6 @@ items: href: ../misc/cs1572.md - name: CS1587 href: ../misc/cs1587.md - - name: CS1668 - href: ../misc/cs1668.md - name: CS1698 href: ../misc/cs1698.md - name: CS1701 diff --git a/docs/csharp/misc/cs1668.md b/docs/csharp/misc/cs1668.md deleted file mode 100644 index 6bc2fe5e21369..0000000000000 --- a/docs/csharp/misc/cs1668.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -description: "Learn more about: Compiler Warning (level 2) CS1668" -title: "Compiler Warning (level 2) CS1668" -ms.date: 07/20/2015 -f1_keywords: - - "CS1668" -helpviewer_keywords: - - "CS1668" -ms.assetid: 313775ad-85f3-4695-8ab8-31c677f9c5f4 ---- -# Compiler Warning (level 2) CS1668 - -Invalid search path 'path' specified in 'path string' -- 'system error message' - - The path supplied to [**AdditionalLibPaths**](../language-reference/compiler-options/advanced.md#additionallibpaths) at the command line was not valid, or a path in the LIB environment variable is invalid. Check the path used to verify that it exists and can be accessed. The error message in single quotation marks is the error returned from the operating system. - -## See also - -- [C# Compiler Options](../language-reference/compiler-options/index.md) -- [C# Compiler Errors](../language-reference/compiler-messages/index.md) diff --git a/docs/csharp/misc/cs1719.md b/docs/csharp/misc/cs1719.md deleted file mode 100644 index 9053e3071f8d7..0000000000000 --- a/docs/csharp/misc/cs1719.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -description: "Learn more about: Compiler Error CS1719" -title: "Compiler Error CS1719" -ms.date: 07/20/2015 -f1_keywords: - - "CS1719" -helpviewer_keywords: - - "CS1719" -ms.assetid: 85f76f97-c056-4f92-8dfa-c0d486b45f59 ---- -# Compiler Error CS1719 - -Error reading Win32 resource file 'File Name' -- 'reason' - - An attempt to read the Win32 resource file failed for the reason given in the error, typically something like "file not found" or "access denied." This error is resolved by correcting the problem described by the reason. diff --git a/docs/csharp/misc/cs2008.md b/docs/csharp/misc/cs2008.md deleted file mode 100644 index d26c75bdca647..0000000000000 --- a/docs/csharp/misc/cs2008.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -description: "Learn more about: Compiler Error CS2008" -title: "Compiler Error CS2008" -ms.date: 07/20/2015 -f1_keywords: - - "CS2008" -helpviewer_keywords: - - "CS2008" -ms.assetid: 13a25a0a-0638-41b7-8b35-9b5d3013bb00 ---- -# Compiler Error CS2008 - -No inputs specified - - The compiler was invoked and compiler options were specified, but no source-code files were passed. diff --git a/docs/csharp/misc/cs2019.md b/docs/csharp/misc/cs2019.md deleted file mode 100644 index c7839b0261203..0000000000000 --- a/docs/csharp/misc/cs2019.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -description: "Learn more about: Compiler Error CS2019" -title: "Compiler Error CS2019" -ms.date: 07/20/2015 -f1_keywords: - - "CS2019" -helpviewer_keywords: - - "CS2019" -ms.assetid: eafd2531-8b3a-499c-9e12-a605a011396f ---- -# Compiler Error CS2019 - -Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module' - - The [**OutputType**](../language-reference/compiler-options/output.md#outputtype) compiler option was used, but an invalid parameter was passed. To resolve this error, recompile the program using the form of the **/target** option that is appropriate to your output file. - - The following sample generates CS2017: - -```csharp -// CS2019.cs -// compile with: /target:libra -// CS2019 expected -class MyClass -{ -} -``` diff --git a/docs/csharp/misc/cs2029.md b/docs/csharp/misc/cs2029.md deleted file mode 100644 index 8edd0a690857a..0000000000000 --- a/docs/csharp/misc/cs2029.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: "Learn more about: Compiler Warning (level 1) CS2029" -title: "Compiler Warning (level 1) CS2029" -ms.date: 07/20/2015 -f1_keywords: - - "CS2029" -helpviewer_keywords: - - "CS2029" -ms.assetid: b55c37d3-f1f8-4281-9b85-bdb01f1fc4fd ---- -# Compiler Warning (level 1) CS2029 - -Invalid value for '/define'; 'identifier' is not a valid identifier - - This warning occurs if the value that is used in the [**DefineConstants**](../language-reference/compiler-options/language.md#defineconstants) option has some invalid characters. - - This warning cannot be suppressed by the [**NoWarn**](../language-reference/compiler-options/errors-warnings.md#nowarn) option. diff --git a/docs/csharp/misc/cs2036.md b/docs/csharp/misc/cs2036.md deleted file mode 100644 index 8ec123f5811e8..0000000000000 --- a/docs/csharp/misc/cs2036.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -description: "Learn more about: Compiler Error CS2036" -title: "Compiler Error CS2036" -ms.date: 07/20/2015 -f1_keywords: - - "CS2036" -helpviewer_keywords: - - "CS2036" -ms.assetid: 44b73be4-b792-4735-bdbd-bd757ab22683 ---- -# Compiler Error CS2036 - -The /pdb option requires that the /debug option also be used. - - Program database files are only generated for debug builds. The **/pdb** option is therefore meaningless in a retail build. - -## To correct this error - -- Add the **/debug** compiler option. - -- Remove the **/pdb** compiler option. - -## Example - - The following example generates CS2036 when it is compiled with the **/pdb** option but not the /debug option: - -```csharp -// cs2036.cs -// Compile with: /pdb -// CS2036 -class Test -{ - public static int Main() - { - return 1; - } -} -``` - -## See also - -- [**PdbFile** (C# Compiler Options)](../language-reference/compiler-options/advanced.md#pdbfile) -- [**DebugType** (C# Compiler Options)](../language-reference/compiler-options/code-generation.md#debugtype) diff --git a/docs/csharp/misc/cs3012.md b/docs/csharp/misc/cs3012.md deleted file mode 100644 index c33aace161289..0000000000000 --- a/docs/csharp/misc/cs3012.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: "Learn more about: Compiler Warning (level 1) CS3012" -title: "Compiler Warning (level 1) CS3012" -ms.date: 07/20/2015 -f1_keywords: - - "CS3012" -helpviewer_keywords: - - "CS3012" -ms.assetid: 1f7555b4-61e4-4821-85c9-586301df4c5c ---- - -# Compiler Warning (level 1) CS3012 - -You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly - -In order for a module to be compliant with the Common Language Specification (CLS) through `[module:System.CLSCompliant(true)]`, it must be built with the **module** element of the [**OutputType**](../language-reference/compiler-options/output.md#outputtype) compiler option. For more information on the CLS, see [Language independence and language-independent components](../../standard/language-independence.md). - -## Example - -The following example, when built without `/target:module`, generates CS3012: - -```csharp -// CS3012.cs -// compile with: /W:1 - -[module:System.CLSCompliant(true)] // CS3012 -public class C -{ - public static void Main() - { - } -} -``` diff --git a/docs/csharp/misc/cs3013.md b/docs/csharp/misc/cs3013.md deleted file mode 100644 index b31ee476d990d..0000000000000 --- a/docs/csharp/misc/cs3013.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: "Learn more about: Compiler Warning (level 1) CS3013" -title: "Compiler Warning (level 1) CS3013" -ms.date: 07/20/2015 -f1_keywords: - - "CS3013" -helpviewer_keywords: - - "CS3013" -ms.assetid: 00b3bbe1-f2a0-465c-be0e-1af700c5753d ---- -# Compiler Warning (level 1) CS3013 - -Added modules must be marked with the CLSCompliant attribute to match the assembly - - A module that was compiled with the **module** element of the [**OutputType**](../language-reference/compiler-options/output.md#outputtype) compiler option was added to a compilation with [**AddModule**](../language-reference/compiler-options/inputs.md#addmodules). However, the module's compliance with the Common Language Specification (CLS) does not agree with the CLS state of the current compilation. - - CLS compliance is indicated with the module attribute. For example, `[module:CLSCompliant(true)]` indicates that the module is CLS compliant, and `[module:CLSCompliant(false)]` indicates that the module is not CLS compliant. The default is `[module:CLSCompliant(false)]`. For more information on the CLS, see [Language independence and language-independent components](../../standard/language-independence.md). From 98a37ea87beff4a55966246b6ae045b11c24467f Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 19 May 2026 15:12:11 -0400 Subject: [PATCH 5/7] consolidate around themes. Consolidate around themes for this area of diagnostics. --- .../invalid-build-command-line.md | 249 ++++++++---------- 1 file changed, 112 insertions(+), 137 deletions(-) diff --git a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md index beefb16e13e0b..76b21abb7886f 100644 --- a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md +++ b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md @@ -69,140 +69,115 @@ This article covers the following compiler errors and warnings: -- [**CS0006**](#anchor-tbd): *Metadata file 'file' could not be found* -- [**CS0007**](#anchor-tbd): *Unexpected common language runtime initialization error — 'description'* -- [**CS0016**](#anchor-tbd): *Could not write to output file 'file' -- 'reason'* -- [**CS1564**](#anchor-tbd): *Conflicting options specified: Win32 resource file; Win32 manifest* -- [**CS1616**](#anchor-tbd): *Option 'option' overrides attribute 'attribute' given in a source file or added module* -- [**CS1668**](#anchor-tbd): *Invalid search path 'path' specified in 'option' -- 'reason'* -- [**CS1719**](#anchor-tbd): *Error opening Win32 resource file 'file' -- 'reason'* -- [**CS1773**](#anchor-tbd): *Invalid version 'version' for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise* -- [**CS2008**](#anchor-tbd): *No source files specified.* -- [**CS2019**](#anchor-tbd): *Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'* -- [**CS2029**](#anchor-tbd): *Invalid name for a preprocessing symbol; 'identifier' is not a valid identifier* -- [**CS2032**](#anchor-tbd): *Character 'character' is not allowed on the command-line or in response files* -- [**CS2036**](#anchor-tbd): *The /pdb option requires that the /debug option also be used* -- [**CS2038**](#anchor-tbd): *The language name 'name' is invalid.* -- [**CS2039**](#anchor-tbd): *Command-line syntax error: Invalid Guid format 'value' for option 'option'* -- [**CS2040**](#anchor-tbd): *Command-line syntax error: Missing Guid for option 'option'* -- [**CS2041**](#anchor-tbd): *Invalid output name: 'name'* -- [**CS2042**](#anchor-tbd): *Invalid debug information format: 'format'* -- [**CS2043**](#anchor-tbd): *'id#' syntax is no longer supported. Use '$id' instead.* -- [**CS2044**](#anchor-tbd): */sourcelink switch is only supported when emitting PDB.* -- [**CS2045**](#anchor-tbd): */embed switch is only supported when emitting a PDB.* -- [**CS2046**](#anchor-tbd): *Command-line syntax error: 'value' is not a valid value for the 'option' option. The value must be of the form 'format'.* -- [**CS3012**](#anchor-tbd): *You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking* -- [**CS3013**](#anchor-tbd): *Added modules must be marked with the CLSCompliant attribute to match the assembly* -- [**CS7038**](#anchor-tbd): *Failed to emit module 'module': 'error'* -- [**CS8751**](#anchor-tbd): *Internal error in the C# compiler.* -- [**CS8771**](#anchor-tbd): *Output directory could not be determined* -- [**CS8772**](#anchor-tbd): *stdin argument '-' is specified, but input has not been redirected from the standard input stream.* - -## CS0006 - -Metadata file 'dll_name' could not be found. - -The program was compiled and explicitly passed the name of a file that contained metadata; however, the .dll was not found. For more information, see [**References** (C# Compiler Options)](../compiler-options/inputs.md#references). - -## CS0007 - -Unexpected common language runtime initialization error — 'description'. - -This error occurs if the runtime could not be loaded. This could occur if the version of the common language runtime that the compiler attempts to load is not present on the machine, or if the common language runtime installation or configuration is corrupt. - -This can happen if the *csc.exe.config* file was changed. This file is configured during setup and should not be changed. If there is a possibility that the *csc.exe.config* file was changed, check the file to make sure that the version of the runtime specified in the file is present on the machine. If the correct version is present, it may be corrupted. Reinstall the common language runtime. - -## CS0016 - -Could not write to output file 'file' — 'reason'. - -The compiler could not write to an output file. Check the path to the file to make sure it exists. If a previously built file is already at the location, make sure it is writeable, and that no process currently has a lock on the file. For example, make sure your executable is not running when you attempt to build. - -## CS1564 - -Conflicting options specified: Win32 resource file; Win32 manifest. - -If you use the **/Win32res** compiler option, you must include the custom Win32 manifest (if it is required) in the resource file. You cannot provide a custom Win32 manifest separately from a Win32 resource file. Use the **/win32manifest** option only if you are not specifying a win32 resource file. - -To correct this error, add the win32 manifest to the win32 resource file and remove the **/win32manifest** compiler option. - -For more information, see [**Win32Manifest** (C# Compiler Options)](../compiler-options/resources.md#win32manifest) and [**Win32Resource** (C# Compiler Options)](../compiler-options/resources.md#win32resource). - -## CS1616 - -Option 'option' overrides attribute 'attribute' given in a source file or added module. - -This warning occurs if the assembly attributes or found in source conflict with the [**KeyFile**](../compiler-options/security.md#keyfile) or [**KeyContainer**](../compiler-options/security.md#keycontainer) command line option or key file name or key container specified in the Project Properties. - -To resolve this warning, remove the conflicting source attribute or remove the conflicting command-line option so they don't contradict each other. - -## CS1668 - -Invalid search path 'path' specified in 'option' -- 'reason'. - -The path supplied to [**AdditionalLibPaths**](../compiler-options/advanced.md#additionallibpaths) at the command line was not valid, or a path in the LIB environment variable is invalid. Check the path used to verify that it exists and can be accessed. The error message in single quotation marks is the error returned from the operating system. - -## CS1719 - -Error opening Win32 resource file 'File Name' -- 'reason'. - -An attempt to read the Win32 resource file failed for the reason given in the error, typically something like "file not found" or "access denied." This error is resolved by correcting the problem described by the reason. - -## CS2008 - -No source files specified. - -The compiler was invoked and compiler options were specified, but no source-code files were passed. - -## CS2019 - -Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'. - -The [**OutputType**](../compiler-options/output.md#outputtype) compiler option was used, but an invalid parameter was passed. To resolve this error, recompile the program using the form of the **/target** option that is appropriate to your output file. - -## CS2029 - -Invalid value for '/define'; 'identifier' is not a valid identifier. - -This warning occurs if the value that is used in the [**DefineConstants**](../compiler-options/language.md#defineconstants) option has some invalid characters. - -This warning cannot be suppressed by the [**NoWarn**](../compiler-options/errors-warnings.md#nowarn) option. - -## CS2032 - -Character 'character' is not allowed on the command-line or in response files. - -Response files and the command line options for csc.exe cannot contain ASCII control characters in the range 0-31 or the pipe (`|`) character. - -Compiler error CS2032 is difficult to demonstrate from the command line because the command line processor and the integrated development environment (IDE) filter out characters that are not valid. The following procedure generates the error by using a [response file](../compiler-options/miscellaneous.md#responsefiles). - -1. In the *My Documents* folder, create a text file that is named *CS2032.rsp*, and then enter the following compiler options in it: `/target:exe /out:cs|2032.exe cs2032.cs` -2. In the *My Documents* folder, create a text file that's named *cs2032.cs* and that contains whatever you want. -3. Open [Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell](/visualstudio/ide/reference/command-prompt-powershell). -4. Change the current directory to `C:\Users\\Documents`. -5. Run the following command from the command prompt: `csc @cs2032.rsp` -6. The CS2032 error message appears because the response file, *CS2032.rsp*, contains a pipe character. - -## CS2036 - -The /pdb option requires that the /debug option also be used. - -Program database files are only generated for debug builds. The **/pdb** option is therefore meaningless in a retail build. - -To correct this error, add the **/debug** compiler option, or remove the **/pdb** compiler option. - -For more information, see [**PdbFile** (C# Compiler Options)](../compiler-options/advanced.md#pdbfile) and [**DebugType** (C# Compiler Options)](../compiler-options/code-generation.md#debugtype). - -## CS3012 - -You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly. - -In order for a module to be compliant with the Common Language Specification (CLS) through `[module:System.CLSCompliant(true)]`, it must be built with the **module** element of the [**OutputType**](../compiler-options/output.md#outputtype) compiler option. For more information on the CLS, see [Language independence and language-independent components](../../../../standard/language-independence.md). - -## CS3013 - -Added modules must be marked with the CLSCompliant attribute to match the assembly. - -A module that was compiled with the **module** element of the [**OutputType**](../compiler-options/output.md#outputtype) compiler option was added to a compilation with [**AddModule**](../compiler-options/inputs.md#addmodules). However, the module's compliance with the Common Language Specification (CLS) does not agree with the CLS state of the current compilation. - -CLS compliance is indicated with the module attribute. For example, `[module:CLSCompliant(true)]` indicates that the module is CLS compliant, and `[module:CLSCompliant(false)]` indicates that the module is not CLS compliant. The default is `[module:CLSCompliant(false)]`. For more information on the CLS, see [Language independence and language-independent components](../../../../standard/language-independence.md). +- [**CS0006**](#input-and-output-file-errors): *Metadata file 'file' could not be found* +- [**CS0007**](#compiler-infrastructure-errors): *Unexpected common language runtime initialization error — 'description'* +- [**CS0016**](#input-and-output-file-errors): *Could not write to output file 'file' -- 'reason'* +- [**CS1564**](#conflicting-or-missing-options): *Conflicting options specified: Win32 resource file; Win32 manifest* +- [**CS1616**](#conflicting-or-missing-options): *Option 'option' overrides attribute 'attribute' given in a source file or added module* +- [**CS1668**](#input-and-output-file-errors): *Invalid search path 'path' specified in 'option' -- 'reason'* +- [**CS1719**](#input-and-output-file-errors): *Error opening Win32 resource file 'file' -- 'reason'* +- [**CS1773**](#invalid-option-values): *Invalid version version for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise* +- [**CS2008**](#input-and-output-file-errors): *No source files specified.* +- [**CS2019**](#invalid-option-values): *Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'* +- [**CS2029**](#invalid-option-values): *Invalid name for a preprocessing symbol; 'identifier' is not a valid identifier* +- [**CS2032**](#invalid-option-values): *Character 'character' is not allowed on the command-line or in response files* +- [**CS2036**](#conflicting-or-missing-options): *The /pdb option requires that the /debug option also be used* +- [**CS2038**](#invalid-option-values): *The language name 'name' is invalid.* +- [**CS2039**](#invalid-option-values): *Command-line syntax error: Invalid Guid format 'value' for option 'option'* +- [**CS2040**](#invalid-option-values): *Command-line syntax error: Missing Guid for option 'option'* +- [**CS2041**](#invalid-option-values): *Invalid output name: name* +- [**CS2042**](#invalid-option-values): *Invalid debug information format: format* +- [**CS2043**](#invalid-option-values): *'id#' syntax is no longer supported. Use '$id' instead.* +- [**CS2044**](#conflicting-or-missing-options): */sourcelink switch is only supported when emitting PDB.* +- [**CS2045**](#conflicting-or-missing-options): */embed switch is only supported when emitting a PDB.* +- [**CS2046**](#invalid-option-values): *Command-line syntax error: 'value' is not a valid value for the 'option' option. The value must be of the form 'format'.* +- [**CS3012**](#module-and-assembly-configuration): *You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking* +- [**CS3013**](#module-and-assembly-configuration): *Added modules must be marked with the CLSCompliant attribute to match the assembly* +- [**CS7038**](#compiler-infrastructure-errors): *Failed to emit module 'module': error* +- [**CS8751**](#compiler-infrastructure-errors): *Internal error in the C# compiler.* +- [**CS8771**](#conflicting-or-missing-options): *Output directory could not be determined* +- [**CS8772**](#invalid-option-values): *stdin argument '-' is specified, but input has not been redirected from the standard input stream.* + +## Input and output file errors + +- **CS0006**: *Metadata file 'file' could not be found* +- **CS0016**: *Could not write to output file 'file' -- 'reason'* +- **CS1668**: *Invalid search path 'path' specified in 'option' -- 'reason'* +- **CS1719**: *Error opening Win32 resource file 'file' -- 'reason'* +- **CS2008**: *No source files specified.* + +These errors indicate that the compiler can't find, read, or write files needed for compilation. For the full list of file-related compiler options, see [C# compiler options - Inputs](../compiler-options/inputs.md) and [C# compiler options - Resources](../compiler-options/resources.md). + +- Verify the path passed to [**References**](../compiler-options/inputs.md#references) or related options points to an existing assembly (**CS0006**). This error typically occurs when an assembly reference in the project file or command line specifies a path that doesn't exist. Check for typos, ensure the referenced project has been built, and confirm the file hasn't been moved or deleted. +- Check the output path to make sure it exists and is writeable, and ensure no process currently has a lock on the file (**CS0016**). For example, make sure your executable isn't running when you attempt to build. If a previously built file is already at the location, verify that it isn't read-only. +- Verify that the path supplied to [**AdditionalLibPaths**](../compiler-options/advanced.md#additionallibpaths) or the LIB environment variable exists and is accessible (**CS1668**). The error message in single quotation marks contains the operating system error that explains why the path is invalid. +- Correct the problem described in the error reason for the Win32 resource file (**CS1719**). The most common causes are "file not found" (verify the path) or "access denied" (check file permissions). +- Pass at least one source-code file to the compiler (**CS2008**). This error occurs when compiler options were specified but no `.cs` files were provided as input. + +## Invalid option values + +- **CS1773**: *Invalid version version for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise* +- **CS2019**: *Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'* +- **CS2029**: *Invalid name for a preprocessing symbol; 'identifier' is not a valid identifier* +- **CS2032**: *Character 'character' is not allowed on the command-line or in response files* +- **CS2038**: *The language name 'name' is invalid.* +- **CS2039**: *Command-line syntax error: Invalid Guid format 'value' for option 'option'* +- **CS2040**: *Command-line syntax error: Missing Guid for option 'option'* +- **CS2041**: *Invalid output name: name* +- **CS2042**: *Invalid debug information format: format* +- **CS2043**: *'id#' syntax is no longer supported. Use '$id' instead.* +- **CS2046**: *Command-line syntax error: 'value' is not a valid value for the 'option' option. The value must be of the form 'format'.* +- **CS8772**: *stdin argument '-' is specified, but input has not been redirected from the standard input stream.* + +These errors indicate that a value passed to a compiler option is malformed or outside the allowed set of values. For the full list of compiler options, see [C# Compiler Options](../compiler-options/index.md). + +- Supply a valid version number for the [**SubsystemVersion**](../compiler-options/advanced.md#subsystemversion) option (**CS1773**). ARM and AppContainerExe targets require version 6.02 or greater; other targets require 4.00 or greater. +- Use one of the valid [**OutputType**](../compiler-options/output.md#outputtype) values: `exe`, `winexe`, `library`, or `module` (**CS2019**). Any other value for the **/target** option is rejected. +- Ensure preprocessing symbols passed to [**DefineConstants**](../compiler-options/language.md#defineconstants) are valid C# identifiers (**CS2029**). Identifiers must start with a letter or underscore and contain only letters, digits, or underscores. This warning cannot be suppressed by the [**NoWarn**](../compiler-options/errors-warnings.md#nowarn) option. +- Remove ASCII control characters (range 0–31) and the pipe (`|`) character from command-line arguments and [response files](../compiler-options/miscellaneous.md#responsefiles) (**CS2032**). The command-line processor and IDE typically filter these characters, so this error most commonly appears when using response files that contain invalid characters. This error is no longer generated by newer versions of the compiler. +- Supply a valid language name recognized by the compiler (**CS2038**). Check the spelling against the list of supported culture names. +- Provide a properly formatted GUID for options that require one, such as **/checksumalgorithm** (**CS2039**, **CS2040**). The GUID must follow the standard format (for example, `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`). +- Remove invalid characters from the output file name (**CS2041**). Output names can't contain characters that are invalid in file paths on the target operating system. +- Provide a valid debug information format value (**CS2042**). Accepted values depend on the compiler version and typically include `full`, `pdbonly`, `portable`, and `embedded`. +- Replace the legacy `id#` syntax with `$id` (**CS2043**). The older syntax is no longer supported by the compiler. +- Supply a value that matches the expected format for the specified option (**CS2046**). The error message indicates the expected form. +- Redirect standard input when using the `-` (stdin) argument (**CS8772**). The compiler expects piped input when you pass `-` as the source file argument. Use a pipeline (for example, `cat file.cs | csc -`) or remove the `-` argument and pass the source file directly. + +## Conflicting or missing options + +- **CS1564**: *Conflicting options specified: Win32 resource file; Win32 manifest* +- **CS1616**: *Option 'option' overrides attribute 'attribute' given in a source file or added module* +- **CS2036**: *The /pdb option requires that the /debug option also be used* +- **CS2044**: */sourcelink switch is only supported when emitting PDB.* +- **CS2045**: */embed switch is only supported when emitting a PDB.* +- **CS8771**: *Output directory could not be determined* + +These errors indicate that compiler options contradict each other, override source-level attributes, or require companion options that weren't specified. For the full list of compiler options, see [C# Compiler Options](../compiler-options/index.md). + +- Include the custom Win32 manifest inside the Win32 resource file and remove the **/win32manifest** compiler option (**CS1564**). You can't specify both [**Win32Resource**](../compiler-options/resources.md#win32resource) and [**Win32Manifest**](../compiler-options/resources.md#win32manifest) simultaneously—if you use **/Win32res**, include the manifest in the resource file. +- Remove the conflicting source attribute or the conflicting command-line option so they don't contradict each other (**CS1616**). This warning occurs when assembly attributes like or in source conflict with the [**KeyFile**](../compiler-options/security.md#keyfile) or [**KeyContainer**](../compiler-options/security.md#keycontainer) command-line option. +- Add the **/debug** compiler option when using [**PdbFile**](../compiler-options/advanced.md#pdbfile), or remove the **/pdb** option (**CS2036**). Program database files are only generated for debug builds, so **/pdb** is meaningless without **/debug**. For more information, see [**DebugType** (C# Compiler Options)](../compiler-options/code-generation.md#debugtype). +- Add the **/debug** option (or set `DebugType` in the project) to enable PDB generation when using **/sourcelink** or **/embed** (**CS2044**, **CS2045**). Source links and embedded source both require PDB output because the source information is stored in the PDB file. +- Ensure the project or command line specifies a valid output directory (**CS8771**). Verify the `OutputPath` or `OutDir` property in your project file, or pass a valid `/out:` argument to the compiler. + +## Module and assembly configuration + +- **CS3012**: *You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking* +- **CS3013**: *Added modules must be marked with the CLSCompliant attribute to match the assembly* + +These warnings involve mismatches between the CLSCompliant attribute on modules and assemblies. For more information on the CLS, see [Language independence and language-independent components](../../../../standard/language-independence.md). + +- Build with the **module** element of the [**OutputType**](../compiler-options/output.md#outputtype) compiler option when specifying `[module:System.CLSCompliant(true)]` (**CS3012**). The CLSCompliant attribute on a module is only meaningful when the output target is a module rather than an assembly. +- Add a matching `[module:CLSCompliant(true)]` or `[module:CLSCompliant(false)]` attribute to modules added via [**AddModule**](../compiler-options/inputs.md#addmodules) so they agree with the assembly's CLS state (**CS3013**). The default is `[module:CLSCompliant(false)]`, so modules that should be CLS compliant must explicitly opt in. + +## Compiler infrastructure errors + +- **CS0007**: *Unexpected common language runtime initialization error — 'description'* +- **CS7038**: *Failed to emit module 'module': error* +- **CS8751**: *Internal error in the C# compiler.* + +These errors indicate failures in the compiler's own infrastructure rather than problems with your source code or command-line options. + +- Verify that the runtime version specified in *csc.exe.config* is installed and not corrupted (**CS0007**). This file is configured during setup and should not be changed. If it was modified, check that the specified runtime version is present on the machine. If the correct version is present but may be corrupted, reinstall the common language runtime. This error is no longer generated by newer versions of the compiler and doesn't apply to the modern `dotnet build` toolchain. +- Try a clean rebuild, verify all assembly references are valid and not corrupted, and check for conflicting reference versions (**CS7038**). This error wraps a lower-level failure during the assembly emit phase. The nested error message provides more specific details about what went wrong. +- [File an issue in the Roslyn repository](https://github.com/dotnet/roslyn/issues/new/choose) with a minimal reproduction (**CS8751**). This error indicates a bug in the compiler itself. Your code exposed a code path the compiler team didn't anticipate. From 850a1fa375a49b6493079c4972df23a852b65965 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 19 May 2026 15:14:20 -0400 Subject: [PATCH 6/7] Update invalid-build-command-line.md proofread --- .../invalid-build-command-line.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md index 76b21abb7886f..4d92971c7a570 100644 --- a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md +++ b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md @@ -108,11 +108,11 @@ That's by design. The text closely matches the text of the compiler error / warn These errors indicate that the compiler can't find, read, or write files needed for compilation. For the full list of file-related compiler options, see [C# compiler options - Inputs](../compiler-options/inputs.md) and [C# compiler options - Resources](../compiler-options/resources.md). -- Verify the path passed to [**References**](../compiler-options/inputs.md#references) or related options points to an existing assembly (**CS0006**). This error typically occurs when an assembly reference in the project file or command line specifies a path that doesn't exist. Check for typos, ensure the referenced project has been built, and confirm the file hasn't been moved or deleted. -- Check the output path to make sure it exists and is writeable, and ensure no process currently has a lock on the file (**CS0016**). For example, make sure your executable isn't running when you attempt to build. If a previously built file is already at the location, verify that it isn't read-only. -- Verify that the path supplied to [**AdditionalLibPaths**](../compiler-options/advanced.md#additionallibpaths) or the LIB environment variable exists and is accessible (**CS1668**). The error message in single quotation marks contains the operating system error that explains why the path is invalid. +- Verify the path passed to [**References**](../compiler-options/inputs.md#references) or related options points to an existing assembly (**CS0006**). This error typically occurs when an assembly reference in the project file or command line specifies a path that doesn't exist. Check for typos, ensure the referenced project is built, and confirm the file isn't moved or deleted. +- Check the output path to make sure it exists and is writable, and ensure no process currently has a lock on the file (**CS0016**). For example, make sure your executable isn't running when you attempt to build. If a previously built file is already at the location, verify that it isn't read-only. +- Verify that the path you supply to [**AdditionalLibPaths**](../compiler-options/advanced.md#additionallibpaths) or the LIB environment variable exists and is accessible (**CS1668**). The error message in single quotation marks contains the operating system error that explains why the path is invalid. - Correct the problem described in the error reason for the Win32 resource file (**CS1719**). The most common causes are "file not found" (verify the path) or "access denied" (check file permissions). -- Pass at least one source-code file to the compiler (**CS2008**). This error occurs when compiler options were specified but no `.cs` files were provided as input. +- Pass at least one source-code file to the compiler (**CS2008**). This error occurs when you specify compiler options but don't provide any `.cs` files as input. ## Invalid option values @@ -133,7 +133,7 @@ These errors indicate that a value passed to a compiler option is malformed or o - Supply a valid version number for the [**SubsystemVersion**](../compiler-options/advanced.md#subsystemversion) option (**CS1773**). ARM and AppContainerExe targets require version 6.02 or greater; other targets require 4.00 or greater. - Use one of the valid [**OutputType**](../compiler-options/output.md#outputtype) values: `exe`, `winexe`, `library`, or `module` (**CS2019**). Any other value for the **/target** option is rejected. -- Ensure preprocessing symbols passed to [**DefineConstants**](../compiler-options/language.md#defineconstants) are valid C# identifiers (**CS2029**). Identifiers must start with a letter or underscore and contain only letters, digits, or underscores. This warning cannot be suppressed by the [**NoWarn**](../compiler-options/errors-warnings.md#nowarn) option. +- Ensure preprocessing symbols passed to [**DefineConstants**](../compiler-options/language.md#defineconstants) are valid C# identifiers (**CS2029**). Identifiers must start with a letter or underscore and contain only letters, digits, or underscores. This warning can't be suppressed by the [**NoWarn**](../compiler-options/errors-warnings.md#nowarn) option. - Remove ASCII control characters (range 0–31) and the pipe (`|`) character from command-line arguments and [response files](../compiler-options/miscellaneous.md#responsefiles) (**CS2032**). The command-line processor and IDE typically filter these characters, so this error most commonly appears when using response files that contain invalid characters. This error is no longer generated by newer versions of the compiler. - Supply a valid language name recognized by the compiler (**CS2038**). Check the spelling against the list of supported culture names. - Provide a properly formatted GUID for options that require one, such as **/checksumalgorithm** (**CS2039**, **CS2040**). The GUID must follow the standard format (for example, `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`). @@ -152,9 +152,9 @@ These errors indicate that a value passed to a compiler option is malformed or o - **CS2045**: */embed switch is only supported when emitting a PDB.* - **CS8771**: *Output directory could not be determined* -These errors indicate that compiler options contradict each other, override source-level attributes, or require companion options that weren't specified. For the full list of compiler options, see [C# Compiler Options](../compiler-options/index.md). +These errors indicate that compiler options contradict each other, override source-level attributes, or require companion options that you didn't specify. For the full list of compiler options, see [C# Compiler Options](../compiler-options/index.md). -- Include the custom Win32 manifest inside the Win32 resource file and remove the **/win32manifest** compiler option (**CS1564**). You can't specify both [**Win32Resource**](../compiler-options/resources.md#win32resource) and [**Win32Manifest**](../compiler-options/resources.md#win32manifest) simultaneously—if you use **/Win32res**, include the manifest in the resource file. +- Include the custom Win32 manifest inside the Win32 resource file and remove the **/win32manifest** compiler option (**CS1564**). You can't specify both [**Win32Resource**](../compiler-options/resources.md#win32resource) and [**Win32Manifest**](../compiler-options/resources.md#win32manifest) simultaneously. If you use **/Win32res**, include the manifest in the resource file. - Remove the conflicting source attribute or the conflicting command-line option so they don't contradict each other (**CS1616**). This warning occurs when assembly attributes like or in source conflict with the [**KeyFile**](../compiler-options/security.md#keyfile) or [**KeyContainer**](../compiler-options/security.md#keycontainer) command-line option. - Add the **/debug** compiler option when using [**PdbFile**](../compiler-options/advanced.md#pdbfile), or remove the **/pdb** option (**CS2036**). Program database files are only generated for debug builds, so **/pdb** is meaningless without **/debug**. For more information, see [**DebugType** (C# Compiler Options)](../compiler-options/code-generation.md#debugtype). - Add the **/debug** option (or set `DebugType` in the project) to enable PDB generation when using **/sourcelink** or **/embed** (**CS2044**, **CS2045**). Source links and embedded source both require PDB output because the source information is stored in the PDB file. @@ -178,6 +178,6 @@ These warnings involve mismatches between the CLSCompliant attribute on modules These errors indicate failures in the compiler's own infrastructure rather than problems with your source code or command-line options. -- Verify that the runtime version specified in *csc.exe.config* is installed and not corrupted (**CS0007**). This file is configured during setup and should not be changed. If it was modified, check that the specified runtime version is present on the machine. If the correct version is present but may be corrupted, reinstall the common language runtime. This error is no longer generated by newer versions of the compiler and doesn't apply to the modern `dotnet build` toolchain. +- Verify that the runtime version specified in *csc.exe.config* is installed and not corrupted (**CS0007**). The setup process configures this file and you shouldn't change it. If you modified the file, check that the specified runtime version is present on the machine. If the correct version is present but might be corrupted, reinstall the common language runtime. Newer versions of the compiler no longer generate this error and it doesn't apply to the modern `dotnet build` toolchain. - Try a clean rebuild, verify all assembly references are valid and not corrupted, and check for conflicting reference versions (**CS7038**). This error wraps a lower-level failure during the assembly emit phase. The nested error message provides more specific details about what went wrong. - [File an issue in the Roslyn repository](https://github.com/dotnet/roslyn/issues/new/choose) with a minimal reproduction (**CS8751**). This error indicates a bug in the compiler itself. Your code exposed a code path the compiler team didn't anticipate. From fa4af3b4da2944c5fb75fae74c1a3e16ea6c3a22 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 19 May 2026 15:31:56 -0400 Subject: [PATCH 7/7] build warnings --- .../compiler-messages/invalid-build-command-line.md | 8 ++++---- .../sorry-we-don-t-have-specifics-on-this-csharp-error.md | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md index 4d92971c7a570..af72321e46a21 100644 --- a/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md +++ b/docs/csharp/language-reference/compiler-messages/invalid-build-command-line.md @@ -76,7 +76,7 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS1616**](#conflicting-or-missing-options): *Option 'option' overrides attribute 'attribute' given in a source file or added module* - [**CS1668**](#input-and-output-file-errors): *Invalid search path 'path' specified in 'option' -- 'reason'* - [**CS1719**](#input-and-output-file-errors): *Error opening Win32 resource file 'file' -- 'reason'* -- [**CS1773**](#invalid-option-values): *Invalid version version for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise* +- [**CS1773**](#invalid-option-values): *Invalid version for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise* - [**CS2008**](#input-and-output-file-errors): *No source files specified.* - [**CS2019**](#invalid-option-values): *Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'* - [**CS2029**](#invalid-option-values): *Invalid name for a preprocessing symbol; 'identifier' is not a valid identifier* @@ -116,7 +116,7 @@ These errors indicate that the compiler can't find, read, or write files needed ## Invalid option values -- **CS1773**: *Invalid version version for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise* +- **CS1773**: *Invalid version for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise* - **CS2019**: *Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'* - **CS2029**: *Invalid name for a preprocessing symbol; 'identifier' is not a valid identifier* - **CS2032**: *Character 'character' is not allowed on the command-line or in response files* @@ -135,7 +135,7 @@ These errors indicate that a value passed to a compiler option is malformed or o - Use one of the valid [**OutputType**](../compiler-options/output.md#outputtype) values: `exe`, `winexe`, `library`, or `module` (**CS2019**). Any other value for the **/target** option is rejected. - Ensure preprocessing symbols passed to [**DefineConstants**](../compiler-options/language.md#defineconstants) are valid C# identifiers (**CS2029**). Identifiers must start with a letter or underscore and contain only letters, digits, or underscores. This warning can't be suppressed by the [**NoWarn**](../compiler-options/errors-warnings.md#nowarn) option. - Remove ASCII control characters (range 0–31) and the pipe (`|`) character from command-line arguments and [response files](../compiler-options/miscellaneous.md#responsefiles) (**CS2032**). The command-line processor and IDE typically filter these characters, so this error most commonly appears when using response files that contain invalid characters. This error is no longer generated by newer versions of the compiler. -- Supply a valid language name recognized by the compiler (**CS2038**). Check the spelling against the list of supported culture names. +- Supply a valid culture name recognized by the compiler (**CS2038**). Check the spelling against the list of supported culture names. - Provide a properly formatted GUID for options that require one, such as **/checksumalgorithm** (**CS2039**, **CS2040**). The GUID must follow the standard format (for example, `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`). - Remove invalid characters from the output file name (**CS2041**). Output names can't contain characters that are invalid in file paths on the target operating system. - Provide a valid debug information format value (**CS2042**). Accepted values depend on the compiler version and typically include `full`, `pdbonly`, `portable`, and `embedded`. @@ -165,7 +165,7 @@ These errors indicate that compiler options contradict each other, override sour - **CS3012**: *You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking* - **CS3013**: *Added modules must be marked with the CLSCompliant attribute to match the assembly* -These warnings involve mismatches between the CLSCompliant attribute on modules and assemblies. For more information on the CLS, see [Language independence and language-independent components](../../../../standard/language-independence.md). +These warnings involve mismatches between the CLSCompliant attribute on modules and assemblies. For more information on the CLS, see [Language independence and language-independent components](../../../standard/language-independence.md). - Build with the **module** element of the [**OutputType**](../compiler-options/output.md#outputtype) compiler option when specifying `[module:System.CLSCompliant(true)]` (**CS3012**). The CLSCompliant attribute on a module is only meaningful when the output target is a module rather than an assembly. - Add a matching `[module:CLSCompliant(true)]` or `[module:CLSCompliant(false)]` attribute to modules added via [**AddModule**](../compiler-options/inputs.md#addmodules) so they agree with the assembly's CLS state (**CS3013**). The default is `[module:CLSCompliant(false)]`, so modules that should be CLS compliant must explicitly opt in. diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index a5b894ad8be53..a39a98a9982da 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -264,7 +264,6 @@ f1_keywords: - "CS9358" - "CS9359" # unsafe evolution - - "CS9360" - "CS9360" - "CS9361" - "CS9362"