5

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?

Stuart
  • 66,722
  • 7
  • 114
  • 165
Bart Verkoeijen
  • 16,545
  • 7
  • 52
  • 56
  • If you delete all references in the portable class library, what does it do? You shouldn't have any references there except potentially your own portable class library projects. – jonathanpeppers Aug 28 '12 at 17:09
  • @jonathanpeppers Thanks for your comment. Deleting the references didn't help, I guess because it's the core assemblies. See the updated question with the names. – Bart Verkoeijen Aug 29 '12 at 14:12
  • 1
    Can you post an example project up somewhere? Doesn't have to be your entire project, just one demonstrating what will not build for you. – jonathanpeppers Aug 31 '12 at 12:27
  • @jonathanpeppers Thanks for your suggestion, I found that basic code can compile. Specific code in the sqlite-net GitHub project can't compile. See the updated question with ref to sample code on GitHub. The build errors are listed in the question. – Bart Verkoeijen Sep 02 '12 at 06:11
  • I've seen this type of problem too - and generally most of my plp mt work is 'on hold' at current. Does it help if you add an explicit reference to mscorlib in your plp project? (I'm guessing not!) it might be worth logging this as a bugzilla bug. – Stuart Sep 02 '12 at 06:24

2 Answers2

1

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.

Community
  • 1
  • 1
Bart Verkoeijen
  • 16,545
  • 7
  • 52
  • 56
0

I've also had a similar problem with the .Net references within a PLP, what I actually did was to remove the existing references and add them back manually from where your .Net Framework is installed, restart MonoDevelop and I was up and running again.

Marius
  • 1
  • 1
    Thanks for your suggestion. By doing this, you're also targeting the full .NET or MonoTouch platform instead of the Portable Library platforms. It compiles, but is not portable. We need full Portable Library support though. – Bart Verkoeijen Sep 13 '12 at 03:24