-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Feature Query API #9665
Feature Query API #9665
Conversation
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.
If we go with the command-line support (does it map to a known requirement or is it for completeness/future-proofing?), I think it would be useful to support asking for several or all features with one invocation. The getProperty
switch is prior art - it prints just the value when asking for one, and JSON-formatted output when asking for many.
Co-authored-by: Ladi Prosek <ladi.prosek@gmail.com>
There are no requirements for command-line support yet, I implemented it for completeness, and might remove it later from the PR. Thanks for suggestion! I agree it is more consistent the way you described. I'll change it to support asking for multiple features. |
We could also expose the new functionality as a property function. This would make it available to project files, and via switches like I think we'd want to get @baronfel's feedback here. The requirements would be met with a programmatic API for MSBuild hosts (e.g. IDEs) but it's definitely useful to explore additional angles. Thank you! |
I agree with Ladi - we should ensure an easy way to check feature enablement at all points that MSBuild can be extended/consumed:
|
Co-authored-by: Roman Konecny <rokonecn@microsoft.com>
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.
Good job!
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
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.
New command line switches should be added to help output (msbuild -h
, dotnet msbuild -h
). Probably ok merging as is, as long as we don't forget to add them as part of fixing #9710.
Fixes #9653
Context
We need an API that can tell us whether a specific feature is available or not.
Changes Made
Added a new API
Usage example:
Command-line support
for switches
/featureavailability
and/fa
.Similar to
/version
switch, iffeatureavailability
switch is detected then ignores other switches./version
switch has higher priority thanfeatureavailability
.There is no logo shown when
/featureavailability
is detected (similar to/getProperty
).Property Function
CheckFeatureAvailability
The result is one of "Undefined", "Available", "NotAvailable" strings.
Usage Example:
$([MSBuild]::CheckFeatureAvailability(Feature1))
Testing
Manual and unit tests.
Notes