Are there any exposed libraries / dll's that can be used for parsing messages from MSBuild? #7907
Unanswered
chadbaldwin
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
tl;dr
Is it possible to access this class to parse msbuild messages myself? For example, parse an msbuild log file into a list of objects?
https://github.com/dotnet/msbuild/blob/main/src/Shared/CanonicalError.cs
Long Version
For the last few weeks, I've been dealing with an ABSOLUTELY MASSIVE SSDT project. When trying to build it...I end up with 30,000+ errors and warnings.
Trying to work with this many issues within Visual Studio is less than stellar. To help alleviate the pain, I've built some PowerShell functions that use regex to parse messages into their parts....filename, error line/col, error/warning...etc.
Eventually I learned that is essentially how MSBuild handles it as well (using regex). Before I go down this path of trying to build MSBuild locally, and then try and figure out how to make this happen, I figured I would ask and see if anyone has a quick answer to save me the time.
My hope is that there is some way to build a DLL that exposes that
CanonicalError.Parse()
method in order to replace my existing PowerShell regex functions.I'm not a C# expert, so I can't really tell just by looking at the code whether or not this would be a simple or monumental task, or if I'm better off with just copy pasting the regex patterns from that class and just doing it myself in PowerShell.
PS
I should mention, I am aware of the MSBuild structured logger tool and binary logs.
However, I'm hoping to build something in PowerShell that can be used against generic text based logs. While the binary logs are nice, and put less overhead strain on the build process, I personally prefer to use text logs for easier grepping and working with in PowerShell on the fly.
Beta Was this translation helpful? Give feedback.
All reactions