phmonte / Buildalyzer

A utility to perform design-time builds of .NET projects without having to think too hard about it.
MIT License
611 stars 94 forks source link

The presence of a (.rsp) file causes problems. #211

Closed chibanemourad closed 2 years ago

chibanemourad commented 2 years ago

Hello First of all, thank you for this very useful tool. I noticed that the presence of a .rsp file containing /bl argument in the tree structure of a .csproj causes a problem when calling the Build() method on a ProjectAnalyzer.

I pushed a repository to reproduce the bug here: AutoResponseFileIssueRepro

daveaglick commented 2 years ago

Interesting, thanks for the repro!

I'm assuming you're talking about a Directory.Build.rsp file? As far as I know a MSBuild.rsp wouldn't get picked up if it's not in the same directory as MSBuild itself. But I guess either way, the problem is really that the /bl flag is conflicting with the logging configuration Buildalyzer has to do.

To be honest I'm not sure how that can be resolved. Buildalyzer works at a foundational level by running MSBuild and instrumenting it with a custom logger that feeds build events back to Buildalyzer over a pipe (which Buildalyzer can then collect and analyze). Given that an .rsp file defines the behavior of MSBuild when run, and if that .rsp file has anything that conflicts with what Buildalyzer is doing, I can see how they'd be incompatible. I've just got no ideas on how to fix it :/. Any thoughts?

daveaglick commented 2 years ago

I guess we could globally disable response files when Buildalyzer is run. That's not ideal because the .rsp might have other important flags, but it's probably better than crashing or breaking.

daveaglick commented 2 years ago

Fix is committed and will go out with the next release (not sure when that'll be, probably later this week or next).