Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MonoTouch with Portable Library Project can't build

In my solution created with MonoDevelop (3.0.3.5) I have 3 projects:

  1. MonoTouch project with UI,
  2. MonoTouch Library project with iOS specific code,
  3. Portable Library project with domain model.

The Portable Library project won't compile, and shows warning symbols on the references (System, System.Core, System.Xml) in MonoDevelop. When I unfold the assembly reference, the following error message is shown:

Assembly not available in .NETPortable 4.0 Profile1 Profile (in Mono 2.10.9)

Same problem reported in this forum thread.

Does anyone have the same problem and is able to solve it?

Update

Demo solution with the build errors can be found on GitHub here (bgever/plp-build-error).

I found out that although the error messages are shown, basic code can be compiled and works as expected.

However, the two variants of build errors preventing the demo solution from compiling are:

public T Get<T> (Expression<Func<T, bool>> predicate) where T : new() { 

Using the generic type System.Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,TResult>' requires10' type argument(s) (CS0305)

So it seems that the 2 argument generic overload Func<T, TResult> is not supported?

public void RunInTransaction (Action action) {

Using the generic type System.Action<T>' requires1' type argument(s) (CS0305)

So it seems that the non-generic version of Action cannot be found?

like image 553
Bart Verkoeijen Avatar asked Nov 12 '22 23:11

Bart Verkoeijen


1 Answers

With the additional error messages, I've found the following SO question: MonoDevelop: is it possible to switch PCL's compiler? With the answer from @mhutch provided, the MonoTouch compiler can be enforced and is then able to compile the code.

However, this is just a workaround, therefore, still it would be great to see proper Portable Class Library support in Mono, MonoDevelop and MonoTouch.

If you need proper Portable Class Library support too: vote for this feature on Xamarin's UserVoice.

like image 156
3 revs Avatar answered Dec 28 '22 09:12

3 revs