Description
Type of issue
Code doesn't work
Description
Semicolons vs Commas in WarningsAsErrors
Hello,
Please consider using semicolons ;
instead of commas ,
in the example for <WarningsAsErrors>...</WarningsAsErrors>
. My tests show that only semicolons work when you have custom error codes that come from custom MSBuild tasks. See the screenshots at the bottom of this message.
-warnaserror
Switch
In addition, please link the MSBuild Switches CLI reference from the table at the top of the discussed article or from the WarningsAsErrors
section. It took me several attempts and dedication to find how to use -warnaserror
with multiple error codes. There are several working syntax options with one code, which are easily found when searching in Google and StackOverflow. However, there seems to be just one reliable approach with multiple error codes, which is documented only on this page, namely, semicolons plus quotation marks:
dotnet build -warnaserror:"TKL002;TKL101;TKL004"
Screenshots
Commas

Semicolons

Page URL
Content source URL
Document Version Independent Id
e57ac82b-307e-163b-8172-52644b3a6baa
Platform Id
c779c5b8-68cc-a425-165e-cd701a8e8824
Article author
Metadata
- ID: 26ef35c2-6df4-26f8-32b2-9b50eb76c037
- PlatformId: c779c5b8-68cc-a425-165e-cd701a8e8824
- Service: dotnet-csharp
- Sub-service: lang-reference