Hi All,
I'm trying to use CanonicalError.cs to output custom warning messages to the Error List window for a build tool I'm creating. The function is great, I can see my warnings in the window and double click to be taken right to them, the only thing that isn't showing is the error codes I have for my warnings.
Here's a repro repository that exhibits the same behaviour, it shows a mimicked version of the object I use to build my messages as well as the exact code used to build them. You might need to change the path in AppUsingBuildTool.csproj in order to make it work, I wasn't too sure how to convert the path into a relative one so I've left it as an absolute as it is on my machine.
For a very brief period of time the warning messages did show the codes, and curiously every warning also showed its column to be 1 whilst the error codes were showing. Since then the codes and columns have not appeared again.
This is how I am calling the tool in my .csproj file:
<Target Name="AfterBuild">
<Exec Command="C:\Users\murray.coueslant\Documents\dev\MarkdownUtility\MarkdownUtility\bin\Debug\MarkdownUtility.exe lint -p docs -r" />
</Target>
I know that the format of the messages have to be very specific, however I have checked the Regexes in CanonicalError.cs against my output using Regex Storm, and they seem to match fine. I can even see the code being shown in the CODE named group stemming from the following line in CanonicalError.cs when I test the pattern against the messages I create,
// Match anything starting with a space that's not a colon/space, followed by a colon.
// Error code is optional in which case "error"/"warning" can be followed immediately by a colon.
+ @"( \s*(?<CODE>[^: ]*))?\s*:"
Here is how I construct my error message, using data from another class inside the tool itself
Console.Out.WriteLine($"{file}({ruleTrigger.LineNumber}, {ruleTrigger.ColumnNumber}): test warning {ruleCode}: {ruleTrigger.RuleDescription} {ruleTrigger.RuleNotes}");
and here's what the build output in Visual Studio shows when the tool is run as an after build event in another project,
1>C:\Users\murray.coueslant\Documents\dev\BuildToolTest\BuildToolTest\docs\docs\07 Procedures\05 IT\04 Firewall.md(24, 1) : test warning MD040: Code fence has no language specified. Code fence on line 24 has no language specified. Correct by specifying a language right after the first set of delimiters.
I'm using Visual Studio 2017, and have MSBuild version 15.1.0.0.
If there is a better place that I should have asked this question, please let me know!
Thanks.
Hi All,
I'm trying to use
CanonicalError.csto output custom warning messages to the Error List window for a build tool I'm creating. The function is great, I can see my warnings in the window and double click to be taken right to them, the only thing that isn't showing is the error codes I have for my warnings.Here's a repro repository that exhibits the same behaviour, it shows a mimicked version of the object I use to build my messages as well as the exact code used to build them. You might need to change the path in
AppUsingBuildTool.csprojin order to make it work, I wasn't too sure how to convert the path into a relative one so I've left it as an absolute as it is on my machine.For a very brief period of time the warning messages did show the codes, and curiously every warning also showed its column to be 1 whilst the error codes were showing. Since then the codes and columns have not appeared again.
This is how I am calling the tool in my .csproj file:
I know that the format of the messages have to be very specific, however I have checked the Regexes in
CanonicalError.csagainst my output using Regex Storm, and they seem to match fine. I can even see the code being shown in theCODEnamed group stemming from the following line inCanonicalError.cswhen I test the pattern against the messages I create,Here is how I construct my error message, using data from another class inside the tool itself
and here's what the build output in Visual Studio shows when the tool is run as an after build event in another project,
I'm using Visual Studio 2017, and have MSBuild version 15.1.0.0.
If there is a better place that I should have asked this question, please let me know!
Thanks.