[mono-android] "The referenced project is targetted to a different framework family (MonoAndroid)"

Jonathan Pryor jonp at xamarin.com
Tue Jan 24 18:27:52 UTC 2012


On Jan 23, 2012, at 11:49 PM, Tom Opgenorth wrote:
> For the test assembly I then added references to Xunit, Rhino.Mocks, my M4A project, and Mono.Android.dll.

No can do. :-)

The problem is that the assemblies are incompatible: Xunit, Rhino.Mocks, and (presumably) your test assembly are going to want mscorlib.dll 2.0/4.0. Your M4A assembly and Mono.Android.dll want mscorlib.dll 2.0.5.0, which is not compatible with mscorlib.dll 2.0/4.0, thus generating your warning:

> I get the warning "The project 'net.opgenorth.m4a.mytrips' cannot be referenced.  The referenced project is targeted to a different framework family (MonoAndroid)" showing up.

The current solution is to remove the Mono.Android.dll dependencies from your M4A assembly (which presumably contains business logic), and then have two projects for this business logic assembly: one targeting .NET, and one targeting Mono for Android. The .NET assembly can be used by your unit tests, while the Mono for Android project can be used by your Mono for Android application.

Alternatively, you'll need to use a unit test engine that works within Mono for Android, such as Andr.Unit:

	http://spouliot.wordpress.com/2011/10/30/andr-unit-joins-the-family/

Is this ideal? No. We'll be working over time to improve the situation, but it'll be awhile.

 - Jon



More information about the Monodroid mailing list