Bug 52673 - MSBuild (mono 4.8) doesn't like item metadata referencing properties referencing items
Summary: MSBuild (mono 4.8) doesn't like item metadata referencing properties referenc...
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 4.6.0 (C8)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Ankit Jain
Depends on:
Reported: 2017-02-22 17:17 UTC by Jonathan Pryor
Modified: 2017-03-08 21:34 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

bxc-52637.zip (1.76 KB, application/zip)
2017-02-22 17:20 UTC, Jonathan Pryor

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jonathan Pryor 2017-02-22 17:17:37 UTC
Nicely formatted version: https://gist.github.com/jonpryor/661edf823539c06cb4cce9ccb4c8ab47

When you have item metadata which uses a property which uses an item group, the item group isn't properly expanded into the item metadata.


    <JdkIncludePath Include="/something" />
    <JdkIncludePath Include="/something-else" />
    <_JdkIncludePaths>@(JdkIncludePath->'-I%(Identity)', ' ')</_JdkIncludePaths>
    <_HostRuntime Include="mono">

Note: above code can't be used as-is, because properties are expanded before items in a single file. The above can be reproduced by using <Import/>s plus multiple files. The above gist.github.com url has actual file contents.

When using `xbuild` and `msbuild` from mono 4.6, `%(_HostRuntime.CFlags)` has the expected value of `-I/something -I/something-else".

When using `msbuild` from Mono 4.8, `%(_HostRuntime.CFlags)` expands to the empty string.
Comment 1 Jonathan Pryor 2017-02-22 17:20:04 UTC
Created attachment 19904 [details]

Test case. Unzip, then build `expansion.targets`:

$ unzip bxc-52673
$ cd bxc-52673
$ msbuild /v:minimal expansion.targets 
Microsoft (R) Build Engine version
Copyright (C) Microsoft Corporation. All rights reserved.

  CFlags: works-with-mono-4.6: 
  CFlags: works-with-mono-4.8: -I/something -I/something-else
Comment 2 Ankit Jain 2017-03-08 21:34:56 UTC
Filed upstream as https://github.com/Microsoft/msbuild/issues/1824 .