Sunday, October 28, 2012

A temporary solution for the Profile1 only bug in MonoDevelop MonoTouch PCL support

Update: install the patch - http://slodge.blogspot.co.uk/2013/02/a-patched-monodevelop-for-pcls.html

Thanks especially to "Jonathan Peppers"...

There is a solution to the problem that MonoDevelop can only build Profile1 for MonoTouch PCL libraries.

The solution is to use Conditional MSBuild attributes.

So... replace:

    <TargetFrameworkProfile>Profile104</TargetFrameworkProfile>
with:
    <TargetFrameworkProfile Condition="'$(OS)' != 'Windows_NT'">Profile1</TargetFrameworkProfile>      <TargetFrameworkProfile Condition="'$(OS)' == 'Windows_NT'">Profile104</TargetFrameworkProfile>
This can be done using Replace In Files :)

Afterwards it seems to work perfectly in both Visual Studio and in MonoDevelop :)

Stuart

6 comments:

  1. where can I change that? which file is that?

    ReplyDelete
  2. You have to do that in each and every one of your portable projects

    ReplyDelete
  3. I'm still receiving 'Assembly not available for .NETPortable 4.0 Profile1 Profile (in Mono 2.10.9)' on MonoDevelop/osx

    ReplyDelete
  4. If that's a clean install of MonoDevelop for MonoToch then you can also try the fix from http://stackoverflow.com/questions/12041290/monodevelop-is-it-possible-to-switch-pcls-compiler/12062589#12062589 (see https://bugzilla.xamarin.com/show_bug.cgi?id=5329)

    ReplyDelete
  5. Hi Slodge, it is a clean install indeed, and the fix suggested on stackoverflow does not fix my problem unfortunately.

    The problem gets stranger and stranger. I'd really like to get this going, but man, what a hassle.

    If I download your project from github and compile it on the mac: i get no errors. If I then do a REBUILD of the project, I get lots of errors.
    My guess is that still the 'Assembly not available for .NETportable 4.0 profile1' is the problem.
    On the first build (the working one) the references are yellow, with a warning sign and the message "'Assembly not available for .NETportable 4.0 profile1'"... after the rebuild they've turned red (same message still) and I get build errors on stuff like Dictionary not found

    ReplyDelete
  6. Maybe move this over to http://forums.xamarin.com/categories/ios - someone from Xamarin can help work it out.

    That bug has been logged since last Summer - it shouldn't still be in NEW State.

    ReplyDelete