diff --git a/docs/csharp/language-reference/compiler-messages/cs0518.md b/docs/csharp/language-reference/compiler-messages/cs0518.md index 1fe37a5fe53d2..4e39b1afd5a50 100644 --- a/docs/csharp/language-reference/compiler-messages/cs0518.md +++ b/docs/csharp/language-reference/compiler-messages/cs0518.md @@ -12,7 +12,9 @@ ms.assetid: b0b61cbb-c9a7-48c9-9e60-7cdd5ecb3e6c Predefined type 'type' is not defined or imported - The main cause for this problem is that the project is not importing mscorlib.dll, which defines the entire System namespace. This can be caused by one of the following: +The main cause for this problem is that the project is not importing mscorlib.dll, which defines the entire System namespace. This can be caused by one of the following: + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] - The [**NoStandardLib**](../compiler-options/advanced.md#nostandardlib) option from the command line compiler has been specified. The **NoStandardLib** option prevents the import of mscorlib.dll. Use this option if you want to define or create a user-specific System namespace. diff --git a/docs/csharp/language-reference/compiler-messages/cs0570.md b/docs/csharp/language-reference/compiler-messages/cs0570.md index c5afe66a0ae5f..e81cf234c7a26 100644 --- a/docs/csharp/language-reference/compiler-messages/cs0570.md +++ b/docs/csharp/language-reference/compiler-messages/cs0570.md @@ -12,7 +12,9 @@ ms.assetid: 6b378974-fdd9-451b-b595-6b5b19b4ab48 Property, indexer, or event 'name' is not supported by the language; try directly calling accessor method 'name!' - This error occurs when using imported metadata that was generated by another compiler. Your code attempted to use a class member that the compiler cannot process. +This error occurs when using imported metadata that was generated by another compiler. Your code attempted to use a class member that the compiler cannot process. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] ## Example 1 diff --git a/docs/csharp/language-reference/compiler-messages/cs1607.md b/docs/csharp/language-reference/compiler-messages/cs1607.md index 7f5c1c7c75a93..3270435fcec4f 100644 --- a/docs/csharp/language-reference/compiler-messages/cs1607.md +++ b/docs/csharp/language-reference/compiler-messages/cs1607.md @@ -13,6 +13,8 @@ ms.assetid: 7ad8e1a4-40c2-41cc-b4ee-cc4d7beb4372 Assembly generation -- reason A warning was generated from the assembly-creation phase of the compilation. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] If you are building a 64-bit application on a 32-bit operating system, you must ensure that 64-bit versions of all referenced assemblies are installed on the target operating system. diff --git a/docs/csharp/language-reference/compiler-messages/cs8178.md b/docs/csharp/language-reference/compiler-messages/cs8178.md index 61288cc8b10b8..2b7f0dff77fb3 100644 --- a/docs/csharp/language-reference/compiler-messages/cs8178.md +++ b/docs/csharp/language-reference/compiler-messages/cs8178.md @@ -11,6 +11,8 @@ helpviewer_keywords: 'await' cannot be used in an expression containing a call to because it returns by reference +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] + ## Example The following sample generates CS8178: diff --git a/docs/csharp/misc/cs0017.md b/docs/csharp/misc/cs0017.md index ac8b11519b2b0..f2010bd78c255 100644 --- a/docs/csharp/misc/cs0017.md +++ b/docs/csharp/misc/cs0017.md @@ -13,6 +13,8 @@ ms.assetid: 5e2a3eb3-6f6e-485d-8293-ceabea4d6905 Program 'output file name' has more than one entry point defined. Compile with /main to specify the type that contains the entry point. A program can only have one [Main](../fundamentals/program-structure/main-command-line.md) method. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] To resolve this error, you can either delete all Main methods in your code, except one, or you can use the [**StartupObject**](../language-reference/compiler-options/advanced.md#mainentrypoint-or-startupobject) compiler option to specify which Main method you want to use. diff --git a/docs/csharp/misc/cs0028.md b/docs/csharp/misc/cs0028.md index a520164c9265d..b94e8aba6378d 100644 --- a/docs/csharp/misc/cs0028.md +++ b/docs/csharp/misc/cs0028.md @@ -13,6 +13,8 @@ ms.assetid: 47df919f-01fa-45ae-a4b7-912445e679e2 'function declaration' has the wrong signature to be an entry point The method declaration for `Main` was invalid: it was declared with an invalid signature. `Main` must be declared as static and it must return either [int](../language-reference/builtin-types/integral-numeric-types.md) or [void](../language-reference/builtin-types/void.md). For more information, see [Main() and Command-Line Arguments](../fundamentals/program-structure/main-command-line.md). + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] The following sample generates CS0028: diff --git a/docs/csharp/misc/cs0067.md b/docs/csharp/misc/cs0067.md index 99d0992e3abfb..7bd10ab6f2a2b 100644 --- a/docs/csharp/misc/cs0067.md +++ b/docs/csharp/misc/cs0067.md @@ -13,6 +13,8 @@ ms.assetid: df75220b-0b93-45ec-8655-98d9333b0bb7 The event 'event' is never used An [event](../language-reference/keywords/event.md) was declared but never used in the class in which it was declared. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] The following sample generates CS0067: diff --git a/docs/csharp/misc/cs0148.md b/docs/csharp/misc/cs0148.md index df51635f5f0e7..3b9f2aaf355c6 100644 --- a/docs/csharp/misc/cs0148.md +++ b/docs/csharp/misc/cs0148.md @@ -12,4 +12,6 @@ ms.assetid: d199afbf-02e1-4a1c-9e36-07bf86f1a2fb The delegate 'delegate' does not have a valid constructor - You imported and used a managed program (one that uses the .NET runtime) that was created with another compiler. That compiler allowed an ill-formed [delegate](../language-reference/builtin-types/reference-types.md) constructor. For more information, see [Delegates](../programming-guide/delegates/index.md). +You imported and used a managed program (one that uses the .NET runtime) that was created with another compiler. That compiler allowed an ill-formed [delegate](../language-reference/builtin-types/reference-types.md) constructor. For more information, see [Delegates](../programming-guide/delegates/index.md). + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] diff --git a/docs/csharp/misc/cs0169.md b/docs/csharp/misc/cs0169.md index aa96107e1c198..d1f7ae60e5294 100644 --- a/docs/csharp/misc/cs0169.md +++ b/docs/csharp/misc/cs0169.md @@ -13,6 +13,8 @@ ms.assetid: 04b0015f-658d-440a-b9ba-831178f1a180 The private field 'class member' is never used A private variable was declared but never referenced. A common way to generate this warning is when you declare a private member of a class and do not use it. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] The following sample generates CS0169: diff --git a/docs/csharp/misc/cs0204.md b/docs/csharp/misc/cs0204.md index e58e41d74c893..2b13f4d7ace00 100644 --- a/docs/csharp/misc/cs0204.md +++ b/docs/csharp/misc/cs0204.md @@ -12,4 +12,6 @@ ms.assetid: c1811479-41b3-4a0b-9160-ecc14bf255a3 Only 65534 locals are allowed - The limit of 65534 local variables has been exceeded in a method. +The limit of 65534 local variables has been exceeded in a method. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] diff --git a/docs/csharp/misc/cs0402.md b/docs/csharp/misc/cs0402.md index d889184a953a0..dbe6ea352b8cf 100644 --- a/docs/csharp/misc/cs0402.md +++ b/docs/csharp/misc/cs0402.md @@ -13,6 +13,8 @@ ms.assetid: 5a252c95-18c7-4569-bae0-e1f7b582cf6a 'identifier' : an entry point cannot be generic or in a generic type The entry point was found in a generic type. To remove this warning, implement Main in a non-generic class or struct. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] ```csharp // CS0402.cs diff --git a/docs/csharp/misc/cs0414.md b/docs/csharp/misc/cs0414.md index 16821ab7c89f2..cf977f1d631d2 100644 --- a/docs/csharp/misc/cs0414.md +++ b/docs/csharp/misc/cs0414.md @@ -12,6 +12,8 @@ ms.assetid: 6a0a80be-799b-4d9c-a7e0-6b91e9ce7be0 The private field 'field' is assigned but its value is never used +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] + This warning can occur in several scenarios in which the compiler can verify that a variable is never referenced: - A private field is assigned a constant value but is never subsequently read. The unnecessary assignment could effect performance. Consider removing the field. diff --git a/docs/csharp/misc/cs0649.md b/docs/csharp/misc/cs0649.md index a40c96b58e602..7d4dea00d5082 100644 --- a/docs/csharp/misc/cs0649.md +++ b/docs/csharp/misc/cs0649.md @@ -13,6 +13,8 @@ ms.assetid: 37137b18-12ed-4a0f-92e6-ee5fb0532ef3 Field 'field' is never assigned to, and will always have its default value 'value' The compiler detected an uninitialized private or internal field declaration that is never assigned a value. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] The following sample generates CS0649: diff --git a/docs/csharp/misc/cs0656.md b/docs/csharp/misc/cs0656.md index ddafdf03d22ac..54b3da81d7b60 100644 --- a/docs/csharp/misc/cs0656.md +++ b/docs/csharp/misc/cs0656.md @@ -12,7 +12,9 @@ ms.assetid: e695280a-e75d-4e8c-aec2-1f3fb455544a Missing compiler required member 'object.member' - One of the following problems exists: +One of the following problems exists: + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] - Your installation of the common language runtime is corrupt. diff --git a/docs/csharp/misc/cs1555.md b/docs/csharp/misc/cs1555.md index d8491abac6f97..8af501306950b 100644 --- a/docs/csharp/misc/cs1555.md +++ b/docs/csharp/misc/cs1555.md @@ -12,4 +12,6 @@ ms.assetid: 1919c8b8-d72c-44af-91d0-674ccde77c3f Could not find 'class' specified for Main method - A class was specified to the [**MainEntryPoint**](../language-reference/compiler-options/advanced.md#mainentrypoint-or-startupobject) compiler option, but the class name was not found in the source code. +A class was specified to the [**MainEntryPoint**](../language-reference/compiler-options/advanced.md#mainentrypoint-or-startupobject) compiler option, but the class name was not found in the source code. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] diff --git a/docs/csharp/misc/cs1556.md b/docs/csharp/misc/cs1556.md index 0da539c379685..660ed92457c66 100644 --- a/docs/csharp/misc/cs1556.md +++ b/docs/csharp/misc/cs1556.md @@ -12,4 +12,6 @@ ms.assetid: 960307d2-d815-4d7a-8f96-e3e78c038ade 'construct' specified for Main method must be a valid class or struct - The [**MainEntryPoint**](../language-reference/compiler-options/advanced.md#mainentrypoint-or-startupobject) compiler option was passed an identifier that was not a class name. +The [**MainEntryPoint**](../language-reference/compiler-options/advanced.md#mainentrypoint-or-startupobject) compiler option was passed an identifier that was not a class name. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] diff --git a/docs/csharp/misc/cs1558.md b/docs/csharp/misc/cs1558.md index 0fa59b5f6175b..72dd2d7c3a86b 100644 --- a/docs/csharp/misc/cs1558.md +++ b/docs/csharp/misc/cs1558.md @@ -12,9 +12,11 @@ ms.assetid: ee603d66-007e-4782-9285-7ff031975f0f 'class' does not have a suitable static Main method - The [**MainEntryPoint**](../language-reference/compiler-options/advanced.md#mainentrypoint-or-startupobject) compiler option specified a class in which to look for a **Main** method. However, the [Main](../fundamentals/program-structure/main-command-line.md) method was not defined correctly. +The [**MainEntryPoint**](../language-reference/compiler-options/advanced.md#mainentrypoint-or-startupobject) compiler option specified a class in which to look for a **Main** method. However, the [Main](../fundamentals/program-structure/main-command-line.md) method was not defined correctly. + +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] - The following example generates CS1558 because of invalid return type. +The following example generates CS1558 because of invalid return type. ```csharp // CS1558.cs diff --git a/docs/csharp/misc/cs5001.md b/docs/csharp/misc/cs5001.md index da8494c2a34fb..540ab0e923f75 100644 --- a/docs/csharp/misc/cs5001.md +++ b/docs/csharp/misc/cs5001.md @@ -14,6 +14,8 @@ Program does not contain a static 'Main' method suitable for an entry point This error occurs when no static `Main` method with a correct signature is found in the code that produces an executable file. It also occurs if the entry point function, `Main`, is defined with the wrong case, such as lower-case `main`. For information about the rules that apply to the `Main` method, see [Main() and Command-Line Arguments](../fundamentals/program-structure/main-command-line.md). +[!INCLUDE[csharp-build-only-diagnostic-note](~/includes/csharp-build-only-diagnostic-note.md)] + If the `Main` method has an `async` modifier, make sure that the [selected C# language version](../language-reference/configure-language-version.md) is 7.1 or higher and to use `Task` or `Task` as the return type. The `Main` method is only required when compiling an executable file, that is, when the **exe** or **winexe** element of the [**TargetType**](../language-reference/compiler-options/output.md#targettype) compiler option is specified. The following Visual Studio project types specify one of these options by default: diff --git a/includes/csharp-build-only-diagnostic-note.md b/includes/csharp-build-only-diagnostic-note.md new file mode 100644 index 0000000000000..f472924a1cc32 --- /dev/null +++ b/includes/csharp-build-only-diagnostic-note.md @@ -0,0 +1,2 @@ +> [!NOTE] +> This warning is only reported during explicit **Build** or **Rebuild** operations. It does not appear during typing in the IDE as part of IntelliSense diagnostics. This means that if you fix the warning by using the field or removing it, the warning might persist in the error list until you build or rebuild the project again.