-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Dotnet MSBuild: Get Property does not expand properties #11735
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
Comments
Triage: the getProperty feature is an MSBuild feature. Properties are evaluated before Items so the behavior makes sense even if it's not what you expected. I think if you set the property in a target and then explicitly ran the target when calling getProperty. I wonder if MSBuild should potentially detect this (ie when it's about to return @ in the getProperty output) and let the customer know how to get this to work. |
Just from the documentation it does not mention that there is a difference, which at least there should be a call out. MSBuild is a beast and it's easy to fall into these little edge cases. Based of the docs it makes it appear like it would be the exact same value as if you are doing a build, which is not the case.
|
In other words, I'd expect The user has a string But this is what MSBuild already does! We have this logic! It is just not wired up with the |
You worded that much better then I would! |
Ok, so this is By Design, but very confusing.
That's exactly what we do! The value after evaluation is the string When a task is invoked, we recursively expand:
We have some documentation on this: subtle effects of the evaluation order--and man does that "subtle" deserve emphasis :( I would not want to do task-invocation-style recursive expansion automatically with I could be convinced about an opt-in mode, though! Getting back an The original feature request (#3911) that turned into |
@ghogen we should see if we can find a way to make the above behavior clearer in docs. |
I would maybe vote for different commands like
(I do use |
Describe the bug
Unlike building thee project or uses msbuild properties in
launchsettings.json
the dotnet cli commanddotnet msbuild --getProperty
does not expand properties correctly, which returns results that don't match other implementations.To Reproduce
Save that xml as
Example.target
and rundotnet msbuild Example.target --getProperty:DynamicValue
which will return@(Item)
instead of the correct1;2
like building the project or uses launch settings.If you run
dotnet msbuild Example.targe -t:Print
you will see it output the correct value of1;2
Fun Facts
The text was updated successfully, but these errors were encountered: