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.
Related
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
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.
I'm trying to create simple DataAccess portable class library for 3 platforms (ios, android, wp7.5).
All I want is to create webrequests, convert data and return it to UI of each platform.
I was able to create library like this (portable) under Mac OS X Xamarin Studio and successfully used it at iPhone app.
But then I opened this solution under Visual Studio (to add Windows Phone UI project) it gave me build error with description that it couldn't find System.Net namespace.
When I checked portable class targets I was surprised to see there even XBOX selected:
When I selected correct targets (MonoDroid/Monotouch/WindowsPhone7.5) I was able to compile but when I start the app I received the following error:
"c:\Downloads\Noname.CrossXam\Noname.CrossXam\Noname.CrossXam.iPhone\Noname.CrossXam.iPhone.csproj"
(_RemoteBuild target) (1) -> (_ResolveAssemblies target) ->
C:\Program Files
(x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(68,3):
error : Exception while loading assemblies:
System.IO.FileNotFoundException: Could not load assembly 'System.Net,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
Perhaps it doesn't exist in the MonoTouch profile? ...
0 Warning(s)
1 Error(s)
Same code (same solution) works just fine under Mac OS X with Xamarin Studio.
Sample solution is here:
https://dl.dropboxusercontent.com/u/19503836/Noname.CrossXam.zip
Please advise.
The issue was in System.Net.dll assembly which is not exists under MonoTouch & MonoAndroid profiles. But that classes are implemented at System.dll under those profile and to make it work you need TypeForwardedToAttribute.
All that type forwarding configuration exists at MVVMCross nuget package which I was able to install only after updating nuget (the last comment from this post: http://slodge.blogspot.com/2013/04/my-current-pcl-setup-in-visual-studio.html)
So there were two issues:
1. Old nuget package manager (update is required)
2. TypeForwardedToAttribute configuration (exists at MvvmCross)
Hope it will be useful for someone.
Have you tried to change target framework to .Net 4.5? You should see Profile104 in your .csproj file
I am working on a C++/CLI project with VS 2012 in Dynamic Library (.dll) and x64 mode.
If I switch the mode to Static Library, I get the error below.
Error 1 error C1107: could not find assembly 'mscorlib.dll': please specify the assembly search path using /AI or by setting the LIBPATH environment variable C:\Depot\Main\Current\Sln\ALibraryProject\Stdafx.cpp 1 1 ALibraryProject
I tried removing the reference to the mscorlib.dll then adding it again from:
Project > Properties > General > Common Properties
But that didn't help. As I know that VS handles the reference to the .NET assemblies, I don't want to add a disk file reference to it as it seems illogical! Did anybody face this before?
I had the same problem when converting my solution from the VS2010 compiler to VS2013 compiler.
I resolved it by changing the project settings (for the project containing the managed .cpp file that was throwing this error) as follows: In Project Settings | C/C++ | General | Additional #using Directories I added the macro $(FrameworkPathOverride). This resolves to the reference assembly directory for the version of .NET that you're targeting, which in my case is C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1
If I switch the mode to Static Library
This is not the typical error you get when you try to build a static library with /clr in effect. I'd have to assume you've been tinkering with project settings to get rid of the inscrutable linker errors you get when you try to do this.
Core issue is that the C++/CLI build system doesn't support static libraries that contain MSIL. Managed code doesn't use a linker, binding happens at runtime. Which makes the essential difference between static libraries and DLLs disappear. So Microsoft decided to not support it because it didn't make much sense to implement it. Unfortunately they don't yell loud enough when you try to do it anyway, the linker errors you get don't give enough of a hint what you did wrong. Workarounds, like merging with ILMerge don't work either, it cannot deal with mixed-mode assemblies. Merging the native code sections and their associated relocation table entries is very untrivial.
Keep in mind that it is fine to link native static libraries. A typical C++/CLI project has only the ref class wrappers that need to be built with /clr in effect. You can glue any amount of native code from libraries into the final assembly.
I'm forced to theorize about the actual compile error, too many programmers get this error for another reason that doesn't have anything to do with building static libraries and they are harassing me in the comments.
Do beware that targeting a different version of .NET than the one you have installed on your machine is quite a hazardous affair, particularly so if you want to target 4.0 and you have 4.5.x installed. The key element in your .vcxproj file is the <TargetFrameworkVersion>. This will be missing if you started the project targeting an old .NET version, you have to insert it yourself. The IDE also doesn't support changing it if it is present, again edit by hand.
Which is enough to coax MSBuild into generating the proper compile command. You can verify if that panned-out well, look in the *.tlog subdirectory of the Debug build directory for your project. The cl.command.1.tlog file shows the options that were passed to the compiler. It should contain:
/AI"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0"
/FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll"
Note the subdirectory, very important that it matches your intended .NET target. v4.0 in this example. And very, very important that it does not point to c:\windows\microsoft.net, the legacy location for reference assemblies.
I have the same problem. Having a dll doesn't work, as I need to provide a native C++ wrapper for a .net object so it can fulfil a natice c++ interface - I can't use .net in a dll interface - this gives a compile error
This worked as a static library in VS 2010 (with .net 4)
Some of my executables and dlls which also have some code with /clr. They don't have an issue. I'm not trying to make a net Lbirary.
I solved it by removing dependency in old and not updated mixed lib, which was also configured only in Debug configuration, and as result, it started to get the same error as yours after I changed some code.
It was not simple to find it, because error is not clear, and the dependency was set up via "Additional Dependencies" in project settings.
Open visual studio and unload your project then Go to the project folder and open file .vcxproj . Search for tag "targetFrameworkVersion"
(if not present it means ur project is not using dot net frameworks.so no requirement of change)
Change it to required version
Save the file.
And now reload the project .
I currently have a VS2012 solution with a WP71 project and a WP8 project. Each of these projects reference a Portable Class Library project where I keep the view models. I also have a Unit Test project that references the PCL and contains tests for the view models.
The problem I'm having is when I compile the unit test project I get the following error:
error CS0012: The type 'System.Windows.Input.ICommand' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
All of the projects, including the unit test project, reference the Portable.MvvmLightLibs NuGet package.
After looking around for this assembly I noticed that there are different versions, one for WP8, one for Silverlight 4, etc. Out of all these versions I'm not sure which to use.
The unit test project is targeting .NET Framework 4.5, so I added the System.Windows assembly for that version which works, but I then get the following error:
error : CA0001 : Could not resolve reference to System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes
Seeing as this is a code analysis error I'm tempted to simply ignore this and carry on, but I was wondering if anyone had any ideas on how to solve this or whether it is safe to ignore it?
So, I figured a way to solve the problem.
To get the test project to compile I had to add the System.Windows.dll assembly from:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71
But, adding it using the Add Reference dialog automatically adds the .NET 4.5 version even if I browsed directly to the folder. To fix this I opened the *.csproj for the test project and replaced the line:
<Reference Include="System.Windows"/>
with
<Reference Include="System.Windows">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71\System.Windows.dll</HintPath>
</Reference>
This ensured that the 2.0.5.0 version was referenced instead of the .NET 4.5 version. The problem with this approach is certain types conflict with other assemblies, namely the System.dll, but seeing as I'm only testing view models from a Portable Class Library, I'm not all that bothered.
Ideally the test project would also be a Portable Class Library, but I've not got round to testing that.
One other issue was I tend to have warnings show up as errors when building in release mode, so this always fails because there will always be a warning complaining about naming clashes with System.dll.