Is it possible to use ServiceStack OrmLite on a Xamarin android project? I'm having a hard time finding the right combination of dlls. I've tried building from ServiceStack.OrmLite.Android.sln and using the resulting dlls, but when I add ServiceStack.OrmLite.Sqlite.Android.dll to the solution I get the following error when I build:
Error 2 Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.Data.Linq.dll'
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute() C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 853 2 AndroidApplication1
I have seen some post around indicating they were able to use Ormlite with a Xamarin android project, but they don't have any details on the implementation and they are old enough that they probably used v3 of ServiceStack.
I'm using the starter edition of ServiceStack, although i don't think that would have any impact.
Thanks,
Estyn
Either build the V3 branch source code or get the DLL's from here:
https://github.com/sami1971/SimplyMobile/tree/master/libs/ServiceStack
You can also fork this branch of ServiceStack.OrmLite if nothing else works, it's where I first published OrmLite Android & iOS support: https://github.com/sami1971/ServiceStack.OrmLite-1
Related
I have an Indie license for Xamarin so that I can develop apps for iPhone/iPad in my most proficient programming language, C#. With this license I can't use the Visual Studio plugin from Xamarin. I still prefer Visual Studio to Xamarin Studio, so I still develop on Visual Studio whatever code that does not need MonoTouch references and then just manually copy the dll into Xamarin Studio.
I have one assembly, .Net framework 4.5, that gets the following error message when I try to debug my app:
Loaded assembly: /Users/EdGriMac/Dropbox/Quiz/Newtonsoft.Json.dll
[External]
2013-09-23 20:30:38.021 Exam936[2228:c07] Could not load 'Newtonsoft.Json' for registration:
System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes
(System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in
/Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/Assembly.cs:351
at MonoTouch.Registrar.OldDynamicRegistrar.RegisterAssembly
(System.Reflection.Assembly a) [0x00000] in
/Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/OldDynamicRegistrar.cs:67
2013-09-23 20:30:38.023 Exam936[2228:c07] This could be due to an outdated assembly kept by the simulator, location:
/Users/EdGriMac/Dropbox/Quiz/Newtonsoft.Json.dll
My tries:
The first thing that springs to mind is that NewtonSoft.Json can't be used with MonoTouch, but I don't know how to find out. Is there a way to find out for sure if a 3rd party dll can be used?
My second idea was that an older or newer version of NewtonSoft.Json could be used by another assembly. This is not a large project, however, and the only other assembly I have that uses Json is RestSharp, but I don't think that uses NewtonSoft.Json. I looked at the web pages for their GitHub page, but was unable to find a reference.
I googled a bit and found this post saying that (a bit down) MonoTouch.Registrar.OldDynamicRegistrar.RegisterAssembly indicates that (quote:) I can't build the app using the build flags --registrar:olddynamic. If I remove that, it now works, I can now link and it appears to be working.. This is probably a setting in Visual Studio you can adjust when you have a Business license. I don't know how to build without these flags.
Is what I am trying to do possible? If yes, what should I do?
Thanks in advance!
The Json.NET version from Xamarin component store (http://components.xamarin.com/view/json.net/) works fine. And it installs directly from within Xamarin Studio
I am developing a sample Xamarin application and i got a build error for Android profile,following is the error.
Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken='.
Perhaps it doesn't exist in the Mono for Android profile? File name: 'Windows.dll' at
Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
Xamarin.Android.Tasks.ResolveAssemblies.Execute()
I couldn't understand what is the exact problem,is windows assembly is not exist in the mono for Android profile? Please help me.
You can see all the available assemblies here:
Xamarin.Android: http://docs.xamarin.com/guides/android/advanced_topics/assemblies
Xamarin.iOS: http://docs.xamarin.com/guides/ios/advanced_topics/assemblies
So no Windows.dll is not available. You can also scan your current assemblies for compatibility here: http://scan.xamarin.com/
there should be updates available in your android sdk.
In a Visual Studio 2012 C# console application, I downgrade ".NET Framework Target" from 4.5 to 4.0. Win 7 Pro with both Frameworks installed.
I then reference an assembly, which, through warnings complains the following:
The primary reference "System.Threading.Tasks.Dataflow, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "System.Threading.Tasks.Dataflow, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
If I try to compile at this point, I error, becuase types and namespaces from referenced assembly aren't available, as if the assembly was not referenced at all.
The "Add Reference" dialog doesn't have any System.Runtime choice, but if I manually brose to
C:\Windows\Microsoft.NET\Framework\v4.0.30319\
and reference the System.Runtime assembly found there, warnings go away and I am able to compile.
Questions:
Is such forcing of the System.Runtime version a potential issue down the road (deployment).
If VS Project properties are seto to target Framework 4.0 (doesn't that relate to targeting the 4.0 SystemRuntime/CLR), why isn't the refferenced DLL picking that up and why manually adding the reference to my project fixes that issue?
Even though the library System.Runtime is inside the C:\Windows\Microsoft.NET\Framework\v4.0.30319\ directory, it is not part of the .NET 4.0 framework. .NET 4.5 is an in-place update of 4.0 and is installed in the same folder with the same version number.
Here is a screenshot that proofs that the library does not exist on a play .NET 4.0 installation:
You can also validate this by browsing to the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework directory where you find the original assemblies for all installed framework versions. You will find the System.Runtime.dll as part of the .NETCore\v4.5 and .NETPortable\v4.5 subdirectories.
The reason that you can add the library to your project is that the runtime did not change between 4.0 and 4.5, so Visual Studio doesn't know or even care that the library you added manually is installed by 4.5. In this case the targetting in Visual Studio is only a filter that avoids that you accidentally add a 4.5 assembly to a project that targets 4.0.
Additional information:
Rick Strahl has a very good blog post on the topic with a more detailed analysis:
http://www.west-wind.com/weblog/posts/2012/Mar/13/NET-45-is-an-inplace-replacement-for-NET-40
Is such forcing of the System.Runtime version a potential issue
Yes, this just won't work. It works on your machine because you have 4.5 installed. Your program will crash and burn on a client machine that only has 4.0. Never add a reference from the Framework directory. It is rather sad that they are still around, they get too many programmers in trouble, but backwards compat is sacred.
The build system can only tell you that you have a problem when you use the reference assemblies. The ones shown in the Add Reference dialog, they are stored in c:\program files\reference assemblies and are not the same as the runtime assemblies. You know that works, you did get the warning. Which, in a somewhat clumsy way, told you that you program won't work on a machine that has 4.0. Don't ignore that warning, you really do have to target 4.5 to use that assembly. Hard requirement you cannot avoid.
why isn't the refferenced DLL picking that up
Because it refuses to build a program that cannot run. Feature, not a bug.
I want to use SmartThreadPool in a Mono for Android Application. Unfortunatley I am getting an error, when I reference the SmartThreadPool.dll from the project:
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(2,2):
Error: Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for
Android profile?
File name: 'System.Web.dll'
at Monodroid.Tuner.MonoDroidResolver.Resolve(AssemblyNameReference reference,
ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1
assemblies, AssemblyDefinition assembly)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute()
I already tried to put the library under the Assets folder and set its BuildAction to AndroidAssets as read in http://adnankhan12.wordpress.com/2012/10/23/android-mono-error-using-other-dlls-novell-monodroid-common-targets. But still it does not work.
At the moment, I am not able to use SmartThreadPool, but on the webpage of the project mono support is stated explicitly. So what am I missing or doing wrong?
Can somebody help me?
Thanks in advance.
According to the API Reference documentation the only class accessible from the namespace System.Web is HttpUtility class.
You might be right that Mono does have SmartThreadPool, however it is not included in Mono for Android and MonoTouch.
You can see which assemblies ship with Mono for Android here, and for MonoTouch here.
EDIT:
Also the DLL you are referencing is not built with either the Mono for Android or Monotouch compile and hence you will have troubles referencing it in your project. You also need to be aware of dependencies it might have.
I have a project using Reactive Extensions and ReactiveUI. I upgraded to the pre release version and I have the following line of code
OAPHCreationHelperMixin.ObservableToProperty(observable,
Function(x) x.Value
Visual studio tells me there is an error here on the method ObservableToPropertyin that the following assembly is missing
Error 9
C:\Users\phelan\workspace\WeinMeasEval\WeinMeasEval\Global\ObservableBinding.vb
Reference required to assembly
'System.Reactive.Interfaces,
Version=2.0.20823.0,
Culture=neutral,
PublicKeyToken=31bf3856ad364e35'
containing the type 'System.Reactive.Concurrency.IScheduler'. Add one to your project.
Now I click the link which suggests it will add the reference and then nothing
happens. If I look in my project references I see that the assembly is indeed
in the assembly list and it is the correct version 2.0.20823.0 and if I look on
the path the DLL is indeed there.
Any ideas?
This is now fixed, check out ReactiveUI 4.0 Preview 5
It turns out that at this date reactive UI is not built yet for .NET 4.5 as the developer is having some build issues.
As a work around I build it myself by pulling the repository from Git and referring to the core library directly from within my .NET 4.5 project.
This seems to work at the moment. YMMV
Do you have Target Framework set to full .net or to Client Profile (in project settings)?