Bug 16188 - Can't compile a MonoTouch project with a PCL assembly for Profile6
Summary: Can't compile a MonoTouch project with a PCL assembly for Profile6
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.0.4.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 7.0.6
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2013-11-13 08:28 UTC by Chris Leow
Modified: 2013-12-13 10:40 UTC (History)
3 users (show)

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

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:
Status:
VERIFIED FIXED

Description Chris Leow 2013-11-13 08:28:19 UTC
I have a MvvmCross project in Xamarin Studio with two assemblies currently, a "Core" assembly compiled with PCL profile 6 (which seems to be the only one with System.Threading.Tasks in .NET 4), and a "UI" assembly.

I can no longer compile my project, which used to work fine before the current update, as I get the following error from the UI project:

The reference 'BlastOutApp.Core' is not valid for the target framework of the project.

Why is my PCL no longer supported?

PS, this is a pretty urgent problem for me!

Here's my current setup:

=== Xamarin Studio ===

Version 4.2 (build 2)
Installation UUID: 1b78c8cb-e7ba-4218-9e4c-d20322b4a2e1
Runtime:
	Mono 3.2.4 ((no/294f999)
	GTK+ 2.24.20 theme: Raleigh
	GTK# (2.12.0.0)
	Package version: 302040000

=== Xamarin.Android ===

Version: 4.8.3 (Business Edition)
Android SDK: /Users/chrisleow/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)
		4.0.3 (API level 15)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Apple Developer Tools ===

Xcode 5.0.1 (3335.23)
Build 5A2053

=== Xamarin.iOS ===

Version: 7.0.4.209 (Business Edition)
Hash: 23a0827
Branch: 
Build date: 2013-11-11 16:04:00-0500

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Build Information ===

Release ID: 402000002
Git revision: a37a8e0cda771d222cabe1f9af29c4d586e7fc7d
Build date: 2013-11-11 22:38:26+0000
Xamarin addins: 2f88a112110098d5c6964bce4251c617c2e8a968

=== Operating System ===

Mac OS X 10.9.0
Darwin Chriss-MacBook-Pro.local 13.0.0 Darwin Kernel Version 13.0.0
    Thu Sep 19 22:22:27 PDT 2013
    root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
Comment 1 Chris Leow 2013-11-13 08:50:41 UTC
Also, forgot to mention:

I had previously had a copy of the .NETPortable framework reference assemblies copied over from a previous installation.  I've added MonoTouch and MonoDroid xml framework files to some of the Profile/xxxxx/SupportedFramework directories, but this doesn't appear to have any effect.
Comment 2 Mikayla Hutchinson [MSFT] 2013-11-13 10:57:19 UTC
Does the file /Library/Frameworks/Mono.framework/Versions/3.2.4/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile6/SupportedFrameworks/Xamarin.iOS.xml exist?

Do you have any files in  /Library/Frameworks/Mono.framework/External/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile6/SupportedFrameworks?
Comment 3 Chris Leow 2013-11-13 11:33:22 UTC
Thanks for the fast reply, no, I don't have the first file:

/Library/Frameworks/Mono.framework/Versions/3.2.4/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile6/SupportedFrameworks/Xamarin.iOS.xml

I have manually created the following files in
/Library/Frameworks/Mono.framework/External/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile6/SupportedFrameworks:

<?xml version="1.0" encoding="utf-8"?>
<Framework
        DisplayName="MonoTouch"
        Identifier="MonoTouch"
        Profile="*"
        MaximumVersion="*"
        MinimumVersion="4.0" />
MonoTouch,Version\=v1.0+.xml (END) 

<?xml version="1.0" encoding="utf-8"?>
<Framework DisplayName="Mono for Android"
        Identifier="MonoAndroid"
        Profile="*"
        MinimumVersion="1.6"
        MaximumVersion="*" />
MonoAndroid,Version\=v1.6+.xml (END) 

Hope this helps!
Comment 4 Martin Baulig 2013-11-13 11:45:14 UTC
Both the directory and the contents of these files is wrong.

We are not using the 'External' directory anymore (anything you put in there would be shared by all different versions of Mono, making it impossible to make updates at a later time without breaking older versions) but instead use the versioned directory:
/Library/Frameworks/Mono.framework/Versions/X/lib/mono/xbuild-frameworks

The correct contents is:
<Framework DisplayName="Xamarin.Android" Identifier="MonoAndroid" Profile="*" MinimumVersion="1.0" MaximumVersion="*" />

and
<Framework DisplayName="Xamarin.iOS" Identifier="MonoTouch" Profile="*" MinimumVersion="1.0" MaximumVersion="*" />

Note the different "MinimumVersion".

If you previous installed the PCL Reference Assemblies into the /Library/Frameworks/Mono.framework/External/xbuild-framework directories, you need to delete those then install Mono 3.2.4.  I'm not entirely sure whether the installer would do that automatically or at least warn you.
Comment 5 Chris Leow 2013-11-13 12:28:44 UTC
This has worked perfectly, thanks!
Comment 6 PJ 2013-12-11 18:45:51 UTC
This fix is planned to be released with Xamarin.iOS 7.0.6, which should hit the beta channel before December 23rd.
Comment 7 Mohit Kheterpal 2013-12-13 10:40:41 UTC
As per comment 5, this issue does not exist any more.

Hence closing this issue.