Bug 7905 - Unable to build portable libraries on OSX
Summary: Unable to build portable libraries on OSX
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Add-in ()
Version: 3.0.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2012-10-18 22:57 UTC by Douglas Linder
Modified: 2012-10-22 12:43 UTC (History)
3 users (show)

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

Microsoft.Portable.CSharp.targets (1.73 KB, text/plain)
2012-10-22 12:41 UTC, Jeffrey Stedfast

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 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.

Related Links:

Description Douglas Linder 2012-10-18 22:57:55 UTC
Creating a new solution, and a new 'portable c# library' product and attempting to build on OSX results in:

/Users/douglasl/projects/FUntime/FUntime/FUntime.csproj: Error: /Users/douglasl/projects/FUntime/FUntime/FUntime.csproj: /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/xbuild/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets: Project file could not be imported, it was being imported by /Users/douglasl/projects/FUntime/FUntime/FUntime.csproj: /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/xbuild/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets could not import "$(MSBuildToolsPath)\Novell\Novell.MonoDroid.CSharp.targets" (FUntime)

A basic sanity check indicates that yes, this file does exist:

[~] date
Fri 19 Oct 2012 10:52:51 WST
[~] ls -l /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/xbuild/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets
-rw-r--r--  1 root  admin  1570  8 May 08:42 /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/xbuild/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets

Possibly this version of the file is broken somehow? 

This was installed as part of the http://xamarin.com/trial download bundle:

[~] ls -l ~/Downloads/*mono*
-rw-r--r--@ 1 douglasl  users  8463572  8 Oct 14:38 /Users/douglasl/Downloads/monoforandroid-eval.dmg

This behaviour has been confirmed on mountain lion on a mac mini and a mac book pro, and a snow leopard imac.

Since making portable libraries the core of making cross platform C# applications and this basic functionality is completely broken, I'm surprised there isn't already a bug report for this, but if I've missed it somehow, my apologies.
Comment 1 Jeffrey Stedfast 2012-10-19 15:48:04 UTC
Could you go to MonoDevelop -> About MonoDevelop and paste the text from the "Version Information" tab?

Are you building inside MonoDevelop? or using md-tool on the command-line?
Comment 2 Douglas Linder 2012-10-19 20:30:29 UTC
From inside monodevelop. I'm not doing anything obscure here; literally creating a solution, creating a project and then running build from the build -> build all menu.

Version information:

Installation UUID: 6279c1a6-a30c-4e3c-8eff-4558467117f8
	Mono 2.10.9 (tarball)
	GTK 2.24.10
	GTK# (
	Package version: 210090011
Apple Developer Tools:
	 Xcode 4.5.1 (1842)
	 Build 4G1004
Mono for Android: 4.2.6 (Evaluation)
Android SDK: /Users/doug/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1 (API level 7)
		2.2 (API level 8)
		2.3 (API level 10)
		3.1 (API level 12)
		4.0 (API level 14)
Java SDK: /usr
Build information:
	Release ID: 30004007
	Git revision: ea0108260c6a376ecaeffcdb7d03387bd51edda3
	Build date: 2012-09-17 14:09:17+0000
	Xamarin addins: ec43fd5cb223ead4234a9858d1b56eef03dad53a-dirty
Operating System:
	Mac OS X 10.8.2
	Darwin dougs-Mac-mini.local 12.2.0 Darwin Kernel Version 12.2.0
	    Sat Aug 25 00:48:52 PDT 2012
	    root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
Comment 3 Jeffrey Stedfast 2012-10-19 21:29:12 UTC
thanks. I probably need to uninstall monotouch to reproduce this... I'll give that a try on monday
Comment 4 Douglas Linder 2012-10-20 21:05:30 UTC
That's interesting. Yes, after installing mono touch building these libraries works fine on all the systems I was having trouble with before.

It seems this issue is limited to the standard alone mono for android installation.
Comment 5 Stuart Lodge 2012-10-21 06:49:53 UTC
I'm having a possibly related problem - http://forums.xamarin.com/discussion/164/pcl-build-problems

My problem might be caused because I've previously adjusted the Microsoft.Portable.CSharp.targets file to make it work with monotouch - see:
- https://bugzilla.xamarin.com/show_bug.cgi?id=5329
- http://stackoverflow.com/questions/12041290/monodevelop-is-it-possible-to-switch-pcls-compiler/12062589#12062589

Not quite sure what to do at present - but I've got lots of projects not currently building (should I log this as a new issue or attach it here?)
Comment 6 Jeffrey Stedfast 2012-10-22 12:16:16 UTC
I can reproduce this now that I have uninstalled MonoTouch
Comment 7 Jeffrey Stedfast 2012-10-22 12:41:13 UTC
Created attachment 2770 [details]

Okay, the problem was that the following line in your Microsoft.Portable.CSharp.targets file:

<Import Project="$(MSBuildToolsPath)\Novell\Novell.MonoDroid.CSharp.targets" Condition = "Exists ('/Developer/MonoAndroid/License.rtf') And !Exists ('/Developer/MonoTouch/License.rtf')"/>

needs to be changed to:

<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" Condition = "Exists ('/Developer/MonoAndroid/License.rtf') And !Exists ('/Developer/MonoTouch/License.rtf')"/>

(e.g. replace MSBuildToolsPath with MSBuildExtensionsPath)

You can find this file at /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/xbuild/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets

I've attached the latest version of this file from git master
Comment 8 Jeffrey Stedfast 2012-10-22 12:43:53 UTC
I've committed a fix for this to the mono-2-10 branch and also to git master (which is where the 3.0 builds will be coming from)

I'll poke our release engineering team to make sure my patch gets into the final 2.10.10 release