dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.21k stars 1.35k forks source link

Proposal: Add CustomIgnoreRegularExpression to Exec Task #7970

Open am11 opened 2 years ago

am11 commented 2 years ago

Similar to CustomWarningRegularExpression, there are opposite use-cases which require filtering out a specific error/warning on stderr. While IgnoreStandardErrorWarningFormat=true prevents all errors and warnings from being emitted on stderr, the proposed CustomIgnoreRegularExpression=pattern will prevent the specific patterns, when IgnoreStandardErrorWarningFormat is false.

i.e. the else if on line 399 https://github.com/dotnet/msbuild/blob/3ade6423189769545ddff2ffeeed37010ec57f4d/src/Tasks/Exec.cs#L395-L404

to be else if (IgnoreStandardErrorWarningFormat || OutputMatchesRegex(singleLine, ref _customIgnoreRegex)), so that if the stderr message matches the pattern, it is printed on stdout regardless of IgnoreStandardErrorWarningFormat.

jrmoreno1 commented 1 year ago

Went to use this today, it shows as being there, but doesn't work. Not sure it should be a request to add it so much as a bug report that it doesn't work.