Bug 23635 - Unified build folder sandboxing for MacOSX build host files copy (project, Content, native libraries, etc...)
Summary: Unified build folder sandboxing for MacOSX build host files copy (project, Co...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.7
Hardware: PC Windows
: Normal normal
Target Milestone: 3.8
Assignee: Adrian Alonso
: 23164 ()
Depends on:
Reported: 2014-10-06 04:40 UTC by Virgile Bello
Modified: 2015-01-19 07:30 UTC (History)
9 users (show)

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

Sample application (3.36 MB, application/zip)
2014-11-06 11:08 UTC, Ram Chandra

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 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 Virgile Bello 2014-10-06 04:40:26 UTC
There is currently no good way to control what is copied to MacOSX host, and where/how it is copied.

Some related issues are bug 23164, as well as bug 23633.

Currently, the only way to get a file copied is to have it as a BundleResource or Content.
However, doing so will also get it copied to the .app bundle (which is sometimes not wanted -- i.e. native libraries).

Also, it will be copied in a path relative to MacOSX root folder (relative path will go out of the MacOSX build folder sandbox).

What would probably be a good way to avoid all those issues would be to:
1/ Only use sandboxed path on MacOSX host (don't copy files directly in mtbs/builds/ProjectName/GUID/MyFile.txt but instead use mtbs/builds/ProjectName/GUID/C:/DEV/Project1/MyFile.txt). That would unify all paths on MacOSX side.
2/ Respect CopyToOutputDirectory (if CopyToOutputDirectory == None, then copy source file to MacOSX host (taking into account the <Link>), so that it can still be used it but it won't be embedded in .app).
3/ Remove <LogicalName> (or keep it internal). Instead, Link should be used (which reverse everything: you create proper hierarchy in your project, and source files could be in another folder). For now we have to use LogicalName to compensate Link issues (and remap everything the opposite way).

I also noticed some issues when using Link, and also when using full path that contains ".." elements (such as <Link>C:\DEV\Project1\..\Project2\content.txt</Link>). It seems that some GetFullPath might be missing.

Let me know if you need to discuss specific details.
Comment 1 Mikayla Hutchinson [MSFT] 2014-10-17 14:47:32 UTC
What exactly is the use case you're trying to make work here? It's not clear to me why you'd want to copy files to the Mac if they're not going to end up in the bundle.

If it's just for native libraries, IMO we'd be better off improving the existing NativeReference build action.
Comment 2 Virgile Bello 2014-10-19 22:59:51 UTC
Main use case was for
- bug 23633 would need to be fixed somehow (can apply to many other things that you copy in the root folder instead of sandboxing).
- also, if we could just use Link instead of opposite LogicalName would help.

Native Linking was just another side effect that might have been fixed easily that way too, but having a NativeReference that works well is probably better. However that wouldn't help the other use cases
Comment 3 Adrian Alonso 2014-10-20 13:19:06 UTC
*** Bug 23164 has been marked as a duplicate of this bug. ***
Comment 4 Adrian Alonso 2014-10-20 14:13:45 UTC
Setting CopyToOutput should copy the files in the output of the mac now too.
Comment 6 Ram Chandra 2014-11-06 11:08:03 UTC
Created attachment 8642 [details]
Sample application

I have try to verify this issue, as this issue is duplicate of bug 23164, so I have used test sample attached in comment3 of bug 23164.

after setting copytooutput "Copyalways" in properties of libmysqlclient.a file it gives same build error again and again.

However if we manually copy the file to the mac build host then it builds successfully.

Hence reopening this issue

I have checked this issue on following environment :
Microsoft Visual Studio Professional 2013
Version 12.0.21005.1 REL
Microsoft .NET Framework
Version 4.5.52742

Installed Version: Professional
Xamarin (f218ea340ead32747337ce247572983dbb7f3c37)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (df7ddb73c75084816b9702208e692a635f976122)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (345e4705a2a1117897f6b66b555eaa4e41462924)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 7 Mohit Kheterpal 2014-11-13 05:40:40 UTC
I have checked this issue with attached sample in comment 6, and observe that build error still occurring with XVS 3.8.135 when we select "Copyalways" in properties of libmysqlclient.a file.

screencast : http://screencast.com/t/OaPmOHqzedjD

However when we build attached project, file 'libmysqlclient.a' is appearing in mac build host as shown in screencast : http://screencast.com/t/WtTksPD4Vs
but file location is different .

Using X.iOS + Xcode 6.1 

Hence reopening this issue.
Comment 9 Mohit Kheterpal 2014-11-17 05:14:09 UTC
I have checked this issue and this issue is working fine now as shown in screencast : http://screencast.com/t/lwbifWYWO

Hence closing this issue.

Using XVS 3.8.145
Comment 10 Jon Goldberger [MSFT] 2014-11-21 14:04:11 UTC
I still got this issue using Xamarin for VS 3.8.150, hence reopening.
Comment 11 Jon Goldberger [MSFT] 2014-11-21 14:08:28 UTC
Oops, I made a mistake. I did not set Copy to Output directory. Resolving again. :-)
Comment 12 Saurabh 2015-01-19 07:30:41 UTC
Changing the status to Verified as per Comment#11