-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permit specifying output file #9640
Conversation
For get* CLI switches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Not 100% sure about the 'side effect' of enabling logging to console, but I guess otherwise this change wouldn't have much sense anyways (as one could just redirect).
Looking forward to have this in an SDK near me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but this should not be merged without test coverage. Please add a test.
Also, ideally the new command line switch would be added to -help
output but -getProperty
and such are still missing from it so we can handle it as part of #9710.
…d/msbuild into add-output-to-file-option
FYI, I called my commit 'Start on test', but that was just because I don't have the components to build on this laptop, so I didn't run it locally before pushing, but it seems to have built and passed 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@Forgind is this a .NET 9 feature only? Or is it expected to become available in a .NET 8 SDK band? |
@tmds it'll be in MSBuild 17.10/SDK 8.0.3xx. |
Good job |
For get* CLI switches
Fixes #
Context
Design question:
Should SimpleErrorLogger be enabled if we're redirecting into a file? Should it be enabled whenever we aren't using TerminalLogger?
The reason I ask is that it's the only thing that writes to stderr at the moment, so since I re-enabled normal loggers when writing to a file, that means I disabled SimpleErrorLogger, and now errors come through stdout (with no TerminalLogger) as MSBuild normally does things. I'm not convinced that's ideal...
Changes Made
Permit using -getResultOutputFile to redirect output from get* into a file. Example:
dotnet msbuild foo.csproj -getProperty:Bar -getResultOutputFile:Biz.txt
This writes the value of property Bar into Biz.txt.
Testing
I tried using this, and it failed to load my test project because it was trying to include $(MonoAndroidResourcePrefix)(various), and MonoAndroidResourcePrefix was not defined. That doesn't feel like it's related to my change, but it's hard for me to firmly state that this works when 100% of my tests have failed 🙃I tried again today, and the error mysteriously disappeared. It failed until I added Flush, but now it seems to work properly.
Notes