Bug 5035 - xbuild is scoping variables differently than msbuild, loosing variables in CallTarget
Summary: xbuild is scoping variables differently than msbuild, loosing variables in Ca...
Status: NEW
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: unspecified
Hardware: PC Mac OS
: Low enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-05-11 15:14 UTC by Chris Hamons
Modified: 2014-12-18 04:38 UTC (History)
7 users (show)

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


Attachments
Example of problem. (4.77 KB, application/x-download)
2012-05-11 15:15 UTC, Chris Hamons
Details
project file (242 bytes, application/octet-stream)
2014-12-18 04:35 UTC, Anton Lauridsen
Details
target file (346 bytes, application/octet-stream)
2014-12-18 04:37 UTC, Anton Lauridsen
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 5035 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 Chris Hamons 2012-05-11 15:14:38 UTC
I've tracked down a build bug in MonoMac down to a difference in variable scoping between xbuild and msbuild.

It appears that when you call CallTarget, you loose variable scope. Compare the two attached results files in the attached zip file. I believe msbuild is doing the right thing and xbuild isn't.
Comment 1 Chris Hamons 2012-05-11 15:15:55 UTC
Created attachment 1862 [details]
Example of problem.
Comment 2 Miguel de Icaza [MSFT] 2012-09-26 17:17:45 UTC
We currently do not have plans to support much more beyond the basics of xbuild that are used by MD.
Comment 3 Vitaliy Filippov 2013-10-16 08:25:35 UTC
I've discovered a similar bug and provided a patch (attached in bug 15431) - you can try it out and see if it fixes your problem.
Comment 4 Ben Rogers 2013-11-13 12:42:12 UTC
I believe we encountered this problem as well. In our particular case, we're copying database vendor ADO drivers to the output directory. It's not a straight forward copy operation as different drivers need to be copied to different directories depending on their bitness (x86 vs x64) and the project type (library vs. web application).

We got this working in MSBuild, but it fails with XBuild. As the other commenters note, XBuild seems to lose the scope when executing the CallTarget task.
Comment 5 inga bemman 2013-11-25 12:20:31 UTC
Same issue. Anyone fixing it?
Comment 6 Anton Lauridsen 2014-12-18 04:34:19 UTC
I've got a simpler example of exactly this bug. Refusing to fix it is pretty much stating that xbuild is being depricated.

This issue will prevent any kind sensible build project.
Comment 7 Anton Lauridsen 2014-12-18 04:35:20 UTC
Created attachment 9117 [details]
project file
Comment 8 Anton Lauridsen 2014-12-18 04:37:53 UTC
Created attachment 9118 [details]
target file

place the .target file and the .proj file in the same folder, xbuild call-issue.proj and observe the output:

MSBUILD:
  Input1=./call-issue.proj
  Input2=./call-issue.proj
XBUILD:
  Input1=./call-issue.proj
  Input2=
Comment 9 Anton Lauridsen 2014-12-18 04:38:28 UTC
Fix the bug or deprecate xbuild, anything else is being dishonest.