phmonte / Buildalyzer

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

Use empty string as key for project properties if TargetFrameworkMonitor is not found #196

Closed echalone closed 2 years ago

echalone commented 2 years ago

I have yet another Pull Request :D But I don't know if or how you want to implement this, or if you can think of a better solution. The thing is, with Visual Studio 2022 the TargetFrameworkMoniker is no longer generated for C++ projects even though it is told so (which kinda makes sense since there's no TargetFramework for C++ projects). This change would use an empty string as the key for project properties if the TargetFrameworkMoniker property wasn't found so the analysis can be run for non C#/Framework projects too, especially C++ projects with Visual Studio 2022. This would mean a change of behaviour since it will now work with projects it hasn't worked with on previous Visual Studio installations too, like installer projects. We could simply accept that or we could introduce an additional optional parameter with EventProcessor class and Build method that would only allow for an empty TargetFrameworkMoniker if specifically told so.

daveaglick commented 2 years ago

This seems low risk, but I'll run it through all my tests before doing a release just to be sure. My only concern would be that normal builds of .NET projects produce some odd "housekeeping" logs that this would have filtered out prior. Otherwise, this looks like another nice low-risk update that expands Buildalyzer use cases - thanks!

echalone commented 2 years ago

Again, thank you, that really helps us :)