Bug 33082 - xbuild does not copy conditional Content/None Include files when referenced from another project
Summary: xbuild does not copy conditional Content/None Include files when referenced f...
Status: NEW
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: 3.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-08-13 19:34 UTC by Martin Potter
Modified: 2015-09-29 14:16 UTC (History)
3 users (show)

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


Attachments
Sample solution with two projects to demonstrate the problem. (5.85 KB, application/zip)
2015-08-13 19:36 UTC, Martin Potter
Details
Project Reference Failure Solution (5.08 KB, application/zip)
2015-09-29 14:16 UTC, Caleb Morris
Details


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 for Bug 33082 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Martin Potter 2015-08-13 19:34:23 UTC
We are trying to switch to using xbuild and are running into problems with project references that contain conditional Content/None elements. Simple repro:

Project A has a project reference to Project C
Project C has a conditional Content element (on the item, ItemGroup, or in a Choose doesn't matter), let's say ProjectC.dll.config

When building with xbuild, the .config file will be copied to the build output for ProjectC, but will not be copied to the build output of ProjectA.

This behavior is the same on 3.4, 4.2-pre and master, although building with Xamarin Studio using the MSBuild engine option builds as expected. On a side note, the "minimal" verbosity for xbuild is not very useful as it doesn't output anything (not even the project name) except the configuration and platform whereas Xamarin Studio outputs the project also.
Comment 1 Martin Potter 2015-08-13 19:36:10 UTC
Created attachment 12497 [details]
Sample solution with two projects to demonstrate the problem.
Comment 2 Martin Potter 2015-08-14 12:40:33 UTC
When copying ProjectC to ProjectA's build output folder, It actually looks like the condition is being evaluated based on the Platform/Configuration properties passed in on the command-line instead of the solution's settings for that project. This can result in incorrect items being copied to the build output of ProjectA.

For example, in the attached solution, ProjectC is set to build Release|MacOSX when building the solution in Release|x86. If you change the condition on the in ProjectC to be '$(Platform)' == 'x86', ProjectC.dll.config with correctly not be copied to ProjectC's build output, but will incorrectly be copied to ProjectA's build output.
Comment 3 Caleb Morris 2015-09-29 14:04:03 UTC
This seems to be a problem with the use of `Condition` in several places.
When trying to use a Condition with `ProjectReference` or `ItemGroup` isn't evaluated at all and will simply include the reference regardless.
Comment 4 Caleb Morris 2015-09-29 14:16:13 UTC
Created attachment 13131 [details]
Project Reference Failure Solution

Attached is an example solution of Condition failure with Project references