I'm creating a Monogame UWP Project and whenever I make a call to an included very basic compiled DLL .NET Core library within the project it throws the Error: Could not load file or assembly System.Runtime 4.1.0.0
Here is the project Sample:
http://www.filedropper.com/game1_2
Is everyone else getting the same Error? How do I go about fixing this issue?
Kind regards, Josh L.
As #iinspectable said in the comments:
You cannot reference a full .NET assembly from a UWP project.
UWP is a thing on it's own, and is basically incompatible with .NET as it needs to run on all Win10 platforms (where .NET is meant to be run on Windows PC). Now i don't know monogame, but if it's a .NET Library, it's incompatible with UWP.
Related
I am currently working on a UWP app (which automatically has reference to Microsoft.NETCore.UniversalWindowsPlatform when I added it). Now I want to reference a class library (contains the models for code reuse) running under .Net Framework 4.5.x into the UWP app but when I try to add the dll it throws this error
" could not be added. The project targets '.NETCore' while file
reference targets '.NETFramework'. This is not a supported scenario."
Is there any work around for this?
Any answers/tips are highly appreciated!
Because as the error says UWP doesn't support .Net libraries.
Possible solution is to extract and port needed code so you can use it in .Net and UWP projects.
There are several options: .Net Standart or Portable class library
I don't have Xamarin yet, and i want to build some application both for android and windows, each will use same shared library.
Is there a possibility to link .NET 4.0 assembly to Xamarin ios/android project, without recompile?
This assembly reference to System only, uses SQLite-NET by praeclarum, which requires native Windows library sqlite3.dll.
As i heard, on Mono/Xamarin? Mono.Data.Sqlite is required instead sqlite3.dll, but i am not sure, can i keep my library "cross-platform" with it? Or i will have to change something?
Unfortunately, i cannot check this currently.
Thank you..
.net assemblies can't be linked to Xamarin Android/iOS but you can link PCLs or you can create a Xamarin Android/iOS project, link files from your .net assemblies there and resolve possible problems with conditional directives (#if...).
I have recently acquired the student licence of Mono Android from Xamarin.
After making a simple project, i decided to start using some DLL's i am familiar with such as Json.Net and H.A.P on my Android Application (mono project), and that's when the problems started.
After trying to pull those references from NuGet, they failed since the "Android Application" project is not known leading to no .dll installed (NuGet tries to match the project type with the correct .dll to be downloaded be it WindowsPhone, .NET4, .NET 3.5 and so on).
So i moved on to mannually referencing the libraries, since i have them downloaded on my PC. Referencing Works, but as soon as i try to access the HtmlAgilityPack it raises an exception.
Error CS0012:
The type 'System.Xml.XPath.IXPathNavigable' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Xml, Version=x.x.x.x, Culture=neutral
The exception is raised on the first execution of the code because of J.I.T compilation of .NET, i know this.
Question:
How can i use my "so loved" .dlls on my Mono Android Project?
Do i need the source code of those libraries in order to use them on my projects?
Thanks in Advance
In order to recompile an assembly you will need the source.
To see what assemblies are provided by Xamarin.Android and Xamarin.iOS you can visit these two pages:
http://docs.xamarin.com/guides/android/advanced_topics/assemblies
http://docs.xamarin.com/guides/ios/advanced_topics/assemblies
One way to recompile it would be to make a Android Class Library or iPhone Class Library and add a link to all the files in the original source and then compile it. Or when Xamarin have their PCL support done, do something similar just in a PCL so that you have one DLL targeting multiple platforms.
You may also find this post useful, which briefly describes how to compile HtmlAgilityPack against Xamarin.Android: http://forums.xamarin.com/discussion/comment/2139/#Comment_2139 You might need to alter some things as this is from December 2012, since then things might have changed.
In Visual Studio 2012 in a blank new Class Library I am trying to add reference to an existing project in the solution, also a Class Library, MonoGame.Framework.Windows8 (https://github.com/mono/MonoGame), but get the error:
Unable to add reference to Project MonoGame.Framework.Windows8
I have built the existing library, MonoGame, successfully and made it a dependency of the new one. What could be the problem?
(It's extremely annoying the error message does not give a reason!)
Trying to add the built dll has a reference gave a more explicit error message which has solved the problem for me, it said:
“A reference to ‘x’ could not be added. The project targets ‘.NetFramework’ while the file reference targets ‘.NetCore’. This is not a supported scenario”
The MonoGame Class Library is a Class Library (Windows Store apps) type! (The bit in parenthesis is important! Presumably the difference is the Windows Store apps type use .Net Core which is not the same as .Net Framework).
So to get it working your project must be a Class Library (Windows Store apps) which is available under the Windows Store option in Add New Project.
I suspect the problem is to do with the 'Target Framework' in project options.
I don't know how MonoGame works for Windows 8 but when you're developing for Android the target framework options are the different versions of Android [e.g. Android 2.2 (Froyo)]. When you create a regular class library you have choices between the different versions of the .NET framework or Mono [e.g. Mono / .NET 4.0].
Unfortunately, these frameworks are not compatible with each other. You can't add a project reference for Android to a .NET framework class library and visa-versa.
The solution is to use a Portable Class Library. They are specifically designed to deal with this issue. The downside is that you will only have access to the subset of assemblies provided in the lowest denominator you choose to target.
You might also want to consider code sharing between projects using linked files. It can make maintenance a little trickier but gives you a little more control over code that should compile in both target frameworks but doesn't fit into the portable class library. Here's a related question:
Project reference vs. file links in Mono multi-target projects
The key to all of this once you understand what's going on here is how you structure your solution. With a little care you can have nearly all your code shared across different platforms.
I might be because of both projects are using different Framework versions and change the Framework versions in both Projects of properties section then your problem might solve.
Same question I guess here:
Visual Studio 11 metro apps unable to add reference?
The answer was:
What are you adding a reference to? Metro style apps can only add references to other Metro style class libraries or portable class libraries
I have developed an windows desktop Application using C# .NET 4 framwork.Now, we are going to using MONO2.10 for cross platform.For sample, I have downloaded the mono 2.10 on windows version and able to run my .net exe.While doing so, Its Working fine and it says error the below mentioned error msg. As per my understanding, I think the DLL Reference is not included properly...
i am using 2 third party dll files in application.
Ionic.dll for .net zip library
DocumentFormat.OpenXml.dll for XML file management.
Please guide me to how to include these dll reference in Mono on windows?
Thanks & Regards,
Saravanan.P
This library is not part of Microsoft .NET or Mono Framework.
Therefore, you just need to either put it in GAC or in the same folder with your application, just like you normally do with third-party components.