Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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
Developer Community or GitHub 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.
Created attachment 5649 [details]
This project reproduces the problem
It appears that using a Condition in a Reference works half-way through the tool chain: mcs is able to obey the condition, but mtouch ignores it.
When I build an application that uses a Reference with a Condition, I see that mcs (correctly) only uses the reference for the active configuration, but mtouch (incorrectly) uses both flavors. The release application uses the Debug assembly and executes the code included via #DEBUG.
Instructions to reproduce:
0. Update the attached application solution to use your own signing credentials
1. Build the debug assembly
2. Build the release assembly
3. Build the debug application, save the build output
4. Build the release application, save the build output
0. For the debug and release application build outputs, compare the calls to mcs and to mtouch
mcs only uses *either* debug or release
mtouch uses *both* debug and release
1. Lines 43..44 of ReleaseBuildOutput.txt
The debug assembly is copied to the release build cache
2. Run the release application on a device, then look at device's Console output from the Xcode Organizer:
"ExerciseConditionalReferences[PID] <Warning>: Echo 'Hello' via debug"
Created attachment 5650 [details]
Sample output from building the Debug application
Created attachment 5651 [details]
Sample output from building the Release application
Note that iOS projects currently use Xamarin Studio's old internal build engine, which only supports a subset of MSBuild features. This will be fixed when we port the iOS build code to MSBuild.
Ok, thanks for explanation of the situation. In the mean time, what can I do?
Some of the assemblies I use are built by me, so I can use project references to correctly account for the debug/release variants at build time. Are there other things I can do for these?
Some of the assemblies I uses are not built by me and I don't have access to their source, which means I cannot use project references. I can use two projects -- one for debug and one for release -- but are there other things I can do for these?
Perhaps you could work around it with a prebuild step to copy the assemblies into some particular place, then reference those. For example, the prebuild command for the Debug configuration would copy lib/Debug/Foo.dll to lib/Foo.dll, the prebuild command for the Release configuration would copy lib/Release/Foo.dll to lib/Foo.dll, and you would reference lib/Foo.dll.
*** This bug has been marked as a duplicate of bug 17180 ***