-
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
Update construct seems to update all items regardless of match when run in target #1618
Comments
tag @cdmihai |
I think this is a bad interaction between metadata-as-attributes and the fact that items are handled differently in targets. Update was possible before the <X Metadata="Just on A" Condition="'%(X.Identity)' == 'A'" />
<X Metadata="Huh" Condition="'%(X.Identity)' == 'NonExistent'" /> That's the best workaround for this. Surprising things:
|
This needs to at least be an error for RTW. I have a case (investigating perf issue with GetTargetFrameworkProperties) where it is very difficult to express as a condition. Basically, I get a item group back from I imagined something like this would work and read nicely: <MSBuild Projects="@(X)">
<Output TaskParameter="TargetOutputs" ItemName="Y" />
</MSBuild>
<ItemGroup>
<X Update="%(Y.OriginalItemSpec)">
<Metadata>%(Y.Metadata)</Metadata>
</X>
</ItemGroup> Variants using conditions did not work out either: <X Metadata="%(Y.Metadata)" Condition="%(X.Identity) == %(Y.OriginalItemSpec)" /> I'm still trying to wrap my head around #1018 (comment) and I can't get it to work. I'd love to find a readable expression of this pattern. |
Btw, it does error out if I use Update="" saying Update can't be empty so it partially knows this is special and not metadata. |
Beat my head against this for quite a while. I think you should just write a Task to do this. The syntax you want wouldn't do what you expect either due to the vagaries of batching rules. |
OK. I'll write a task. :) Still pushing for that error in RTW. |
Included in #1124 |
NOTE: This was closed because it's a subset of #1124, not because it was fixed. |
I'm trying to do exactly what @nguerrera is trying to do here with similar results. |
I've just run across this and it was extremely confusing. |
Expected after target runs:
Actual:
@AndyGerlicher @rainersigwald
The text was updated successfully, but these errors were encountered: