Reputation: 1679
I've just upgraded to the latest Xamarin build and although all my libraries are referenced I keep getting these errors:
Error CS0012: The type ServiceStack.ServiceHost.IReturn
1' is defined in an assembly that is not referenced. Consider adding a reference to assembly `ServiceStack.Interfaces, Version=3.9.55.0, Culture=neutral, PublicKeyToken=null' (CS0012) (Place.Logic)
Error CS0012: The type ServiceStack.ServiceHost.IReturn' is defined in an assembly that is not referenced. Consider adding a reference to assembly
ServiceStack.Interfaces, Version=3.9.55.0, Culture=neutral, PublicKeyToken=null' (CS0012) (Place.Logic)
(The monotouch DLLs have incorrect version numbers on the release builds I think)
****UPDATE
From comments and links and this one: Xamarin Studio iOS assembly error
it appears the DLLs need to be recompiled from source if not using particular command line toold.
Unfortunately, the source files on Servicestack monotouch source files are incomplete and keeps saying: Servicestack.Text.Monotouch (Load failed). Has anyone managed to recompile these and put them up for public use?
***UPDATE
Adding the monotouch version of the source files results in Xamarin Studio complaining that files are incompatible ie. Monotouch v1.0, when attempting to select them as a reference within the same solution file.
***WORKAROUND
My DTO DLL was referencing ServiceStack DLLs and raising issues with versioning etc. So I've ended up duplicating the DTO source files into my Xamarin projects from the server side logic. Works for now although I'm not happy I have duplicates of the same code :(
Upvotes: 4
Views: 717
Reputation: 2773
In general, MonoTouch projects may only reference other MonoTouch projects or MonoTouch builds of assemblies. (You could make exceptions for appropriately targeted Portable Class Libraries.)
Thus, even if your app references the ServiceStack MonoTouch assemblies, but your DTO project references the non-MonoTouch ServiceStack assemblies, and your app references that DTO project, it will fail as you describe.
So, yes, as you mention, it is common-practice to have a MonoTouch project along-side a standard project with the same source. The MonoTouch project is just a shell referencing the files in the standard project. (There are multiple practices for keeping these projects in sync, and this is an area of continued development. One trick, for example, is to use wildcards in the .csproj file.)
Finally, it is worth noting that the version of ServiceStack that you reference in your client app does not strictly need to match the version of ServiceStack referenced in the server project. The conventions by which ServiceStack resolves service URLs and serializes/deserializes DTOs have been fairly stable. Thus you could upgrade ServiceStack on your server w/out upgrading your client.
Upvotes: 1