Bug 9163 - Can't use PCLs in MonoMac or in XamMac
Summary: Can't use PCLs in MonoMac or in XamMac
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2012-12-30 07:41 UTC by Stuart Lodge
Modified: 2013-03-16 14:19 UTC (History)
2 users (show)

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

Add reference monomac (98.53 KB, image/png)
2012-12-30 07:42 UTC, Stuart Lodge
Add reference xammac (85.15 KB, image/png)
2012-12-30 07:42 UTC, Stuart Lodge

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 Stuart Lodge 2012-12-30 07:41:54 UTC
Following http://forums.xamarin.com/discussion/599/portable-class-libraries-supported#latest and https://bugzilla.xamarin.com/show_bug.cgi?id=8092

I've tried to use PCLs in MonoMac and XamMac - both fail at the first hurdle of trying to get them referenced inside MonoDevelop :/ 

I tried also at the binary level - referencing compiled assemblies - and this got messy quickly... so I gave up :(

Attached are some screenshots.

My version info is:


MonoDevelop 3.1.1
Installation UUID: 9834046b-628d-443a-af61-cecf9bfc34bd
	Mono 2.10.9 (tarball)
	GTK 2.24.10
	GTK# (
	Package version: 210090011
Mono for Android: 4.4.41
Android SDK: /Users/stuartlodge/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		1.6   (API level 4)
		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)
		4.0.3 (API level 15)
		4.2   (API level 17)
Java SDK: /usr
Apple Developer Tools:
	 Xcode 4.5.2 (1847)
	 Build 4G2008a
Xamarin.Mac: Not Installed
Monotouch: 6.0.7
Build information:
	Release ID: 30101000
	Git revision: 5d928ec4f9d5864b4db04a1301b8a8649b43fb9d
	Build date: 2012-12-14 19:11:30+0000
	Xamarin addins: 80f2dcc8fe4ed316b3e77dde496fc33d90305047
Operating System:
	Mac OS X 10.8.2
	Darwin Stuarts-MacBook-Air.local 12.2.1 Darwin Kernel Version 12.2.1
	    Thu Oct 18 16:32:48 PDT 2012
	    root:xnu-2050.20.9~2/RELEASE_X86_64 x86_64


If fixing, please advise which MonoDevelop, MonoMac and XamMac versions I should test with - thanks.

(I will try to get monodevelop building again myself this next year!)
Comment 1 Stuart Lodge 2012-12-30 07:42:22 UTC
Created attachment 3144 [details]
Add reference monomac
Comment 2 Stuart Lodge 2012-12-30 07:42:46 UTC
Created attachment 3145 [details]
Add reference xammac
Comment 3 Stuart Lodge 2013-01-21 04:35:55 UTC
Any news?
Comment 4 Stuart Lodge 2013-01-29 18:52:58 UTC
Any news?
Comment 5 Stuart Lodge 2013-01-29 18:56:07 UTC
If he answer is No I can take it - I just need to know what to feed back to the people asking me (and sending me Pull requests) about mvvmcross .mac support.

I was hopeful because of the 'make it a priority' comment on 8092 - but I understand things change(
Comment 6 Jeffrey Stedfast 2013-01-29 19:53:49 UTC
Hey Stuart, sorry about the silence (things have been a bit crazy).

I *think* this may be resolved in the upcoming 4.0 release, I know I made things more flexible as to which profiles would get matched (which looks like the problem you are hitting).

I need to double-check that the patches I am thinking of didn't make it into 3.1.1 (if they are, then obviously those patches weren't enough).
Comment 7 Jeffrey Stedfast 2013-01-29 20:00:15 UTC
Bah, this was the patch I was thinking of: https://github.com/mono/monodevelop/commit/f087ce42ef5a278821cd2b825f8a121d5c885e39

Looks like it made it into MonoDevelop 3.1.1 :(
Comment 8 Jeffrey Stedfast 2013-01-29 20:10:37 UTC
Going to reassign to myself so I don't lose sight of this bug again.
Comment 9 Stuart Lodge 2013-01-30 02:32:36 UTC
Thanks Jeff

Sorry - I admit I do get a little frustrated at bugzilla bugs just sitting there in new - but I also don't want to get in your way or to divert you off of the shiny new toys either - really looking forwards to seeing what ships at evolve. I can imagine what your todo list looks like - and that there are 100s of things clamouring for your time. Also I know PCLs aren't high on xam's list - although they are slowly getting higher ;)

I'll also put it on my list to try to get a mono develop build environment up and running again - always more to do :)

Thanks again


P.S. I presume you missed a not - you meant it didn't make it into 3.1.1 :(
Comment 10 Stuart Lodge 2013-01-30 07:49:12 UTC
Also... if anyone is fixing PCL stuff for 3.1.2 please can you reinvestigate http://slodge.blogspot.co.uk/2013/01/if-pcls-will-not-build-for-you-in.html as I've been asked about it by 3 separate people (2 customers, 1 online-peer-coder) already this morning
Comment 11 Jeffrey Stedfast 2013-01-30 10:03:09 UTC
No, the patch *did* make it into 3.1.1, the sad-face was because it obviously didn't fix the issue you are seeing which means there's something else causing the problem you are seeing.

Anyways, no worries, starting this week I've had more flexibility with being able to fix bugs that didn't make it into the "absolutely critical for the 4.0 release omg omg omg panic" list, and this one is a good one for me to look into now, before the 4.2 crunch begins :-)

FWIW, I don't think there will be a 3.1.2, afaik 4.0 will be the next release (not accounting for acts of God).

To answer the question in the link, I'm pretty sure that the problem there is that since the fix was in MonoFramework (and not MonoDevelop or MonoTouch) and because no new releases of Mono 2.10.x have gone out, the fix is still unavailable.

The good news is that there will be a new MonoFramework 2.10.11(?) that will be released along side MonoDevelop 4.0 which I expect in the next 2 weeks or so.

In the mean time, maybe I can look into grabbing the fixed *.targets files that you could install into your /Library/Frameworks/Mono.framework/* directory. Assuming the fixes were just *.targets files and not fixes to xbuild or something.
Comment 12 Stuart Lodge 2013-01-30 13:10:44 UTC

If v4 is 2 weeks off, then don't worry about '*.targets' in the meantime - I'll just get the standard email reply ready to cut and paste - most of us Pee-Cee folk need talking through how to find and unlock the hidden directory as well how to edit the file :) When there's an alpha of 4, I'll check it over - at least to the point or running the new PCL wizard and seeing whether I can add the PCL to a MonoTouch and to a M/X.Mac project.



P.S. What's weird about the question in the link is I could have sworn a clean install worked for me at one point - but maybe it's my mind playing tricks on me. I've dabbled in Alpha and in 3 - so maybe that did it :)
Comment 13 Jeffrey Stedfast 2013-01-30 15:31:28 UTC
Okay, so I've found and fixed the problem but it's too late for at least the initial 4.0 release

I don't think this likely ever worked for MonoMac/XamMac (or any other .NETFramework v4.0+ project), but it did/does work for MonoDroid and MonoTouch because the IsCompatibleWithFramework() logic had a hack for those to always return true.
Comment 14 Stuart Lodge 2013-01-30 15:39:37 UTC

Sorry to hear it won't make 4.0 - but at least it's on the way now.



As a genuine question - I sometimes feel like a toddler screaming 'I want my PCLs' on here until I get some attention... As one of the devs, would you rather I shout about these problems louder or quieter next time? I'm guessing Evolve deadlines would mean that timing wouldn't have been any earlier, but I'm also guessing this would have gotten lost if I hadn't reposted to the reports...

(Maybe I should just bite the bullet and spend whatever it takes getting a full MonoDevelop build env up and running...)
Comment 15 Jeffrey Stedfast 2013-01-30 15:40:51 UTC
Here's the fixed Microsoft.Portable.CSharp.targets: https://files.xamarin.com/~jeff/Microsoft.Portable.CSharp.targets
Comment 16 Jeffrey Stedfast 2013-01-30 16:20:19 UTC
I don't mind a poke now and then

I back-ported my PCL fixes to the 3.1 branch and let the build bots build new 3.1.1 binaries for Windows and Mac and uploaded them here:

Comment 17 Seifer 2013-03-16 06:08:05 UTC
Hi Jeffrey,

Are there any plans to support the fix in Xamarin Studio?
Comment 18 Stuart Lodge 2013-03-16 06:11:28 UTC
There is a release of that somewhere - check jeff's tweets, my blog, the forum posts - or I'll post a link when I get back online properly
Comment 19 Seifer 2013-03-16 08:14:18 UTC
Hi Stuart,

I surfed stackoverflow, your blog, forums.xamarin.com and bugzilla.xamarin.com.
The best answer I've seen - install patch for MonoDevelop-3.1.1 (as mentioned in comment 16).

Seems I missed the required link in all these conversations. Please, could you find the link.
Comment 20 Stuart Lodge 2013-03-16 11:40:40 UTC
Not on a good network - sorry - try

<blockquote class="twitter-tweet"><p>@<a href="https://twitter.com/slodge">slodge</a> btw, <a href="http://t.co/hNmqAIZVGs" title="http://files.xamarin.com/~jeff/MonoDevelop-c015b551ceb5f43c864b039b0abd487dd46b5dc2.dmg">files.xamarin.com/~jeff/MonoDeve…</a></p>&mdash; Jeffrey Stedfast (@jstedfast) <a href="https://twitter.com/jstedfast/status/304741418470105088">February 21, 2013</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

copied link from twitter!
Comment 21 Jeffrey Stedfast 2013-03-16 11:45:34 UTC
I'm pretty sure that Xamarin Studio 4.0.2 (I think it's in beta?) has my fixes as well.
Comment 22 Seifer 2013-03-16 14:19:02 UTC
Hi Jeffrey and Stuart,

The patch allows to add PCL reference to Console projects.
But it's impossible to add PCL reference to Droid/Touch projects.

Steps to reproduce:
1. Create PCL project
2. Create Android project
3. Add PCL reference to Android project.

Although it's possible to edit *.csproj manually.
Add references a little bit complex, especially when set up new solution with many references (for example MvvmCross).

Looks like the issue is related to  https://bugzilla.xamarin.com/show_bug.cgi?id=8092

Test project: https://github.com/SeeD-Seifer/PCL-Test