MonoMac Could Not Load Assembly or Dependency - c#

I have a fairly simple application that I built using MonoDevelop 3.0/XCode 4.0/.NET 4.0 on OS X 10.7 (Lion). Basically, I have a Windows GUI and a Mac GUI for the application, and both share a class library. The class library is very simple (deliberately), and passes the MoMA tests with flying colors. My OS X GUI runs perfectly on my development OS X machine, but when I create a .pkg file and install it on a test OS X machine, it won't run at all. I have the Mono runtime installed on the test machine -- the runtime only, not the SDK or MonoDevelop. The application will open, but as soon as I make a call into the shared library, it fails with
System.IO.FileNotFoundException: Could not load file or assembly 'xxx' or one of its dependencies.
My shared library only has the following dependencies:
System
System.Configuration
System.Core
System.Xml.Linq
System.Data.DataSetExtensions
Microsoft.CSharp
System.Data
System.Xml
Surely the basic Mono framework supports all of these assemblies, right? What am I missing? I can't believe that releasing a simple application like this (via .pkg file, not AppStore) is so difficult! Could someone please point me in the right direction? Thanks.

OK, so, total noob/forehead slapping moment: the reason my application ran on my development OS X environment but not on the test box? .NET framework! I built the class library with Visual Studio 2012/.NET 4.5/Windows 7, checked it with MoMA, then copied it to my dev OS X, set a reference to it in my MonoMac project, and everything was fine, right? That's because that box had MonoDevelop and the .NET framework on it! When I created my .pkg and installed it on a new OS X box, the install was smart enough to download and install the Mono environment, but not the .NET framework, and who can blame it? The solution: build the class library against Mono 4.0, and use that assembly in my MonoMac release! Problem solved.
Thanks for help and comments. Please forgive the basic stupidity of this question: I'm not only a Mono/OS X noob, I'm a desktop development noob, too. I'm a web guy, for cryin' out loud!

Related

C# Use MKL library in mono

I have C# Console project that develop in visual studio on Windows with .net framework 4.6. In my project use MKL and IPP library. In Windows my project run correctly. I migrate to CentOS 7 and want run my project in this OS. I have several problem that resolved. Now my project build successful and run correct until now use MKL library. In first use of MKL get System.DllNotFoundException" mkl_rt.dll error. but all MKL dll (include of mkl_rt.dll) exist beside of .exe file.
You can download MKL for linux from https://software.intel.com/en-us/mkl/choose-download
after install this .so file exist. you can find libmkl_rt.so and copy it beside your .exe file or add this to ldconfig.
One note - Libmkl_rt.so enables you to select the interface and threading library for Intel MKL at run time. By default, libmkl_tr.so is linking with intel threading run time – libiomp5. Therefore in your cases, you need to add this shared object into your system paths as well. See more details follow mkl developer user guide “Using the Single Dynamic Libraries”

Using System.Drawing package from multiple machines (multiple OS)

We are building a .Net Core 2.0 C# web app that uses System.Drawing package.
I am writing code on Mac, but it will be also developed on the Windows machine, and deployed into Linux server.
To use System.Drawing on OSX I had to add runtime.osx.10.10-x64.CoreCompat.System.Drawing Nuget package to my project dependencies.
But that code now doesn't work on the Window machine.
We get the System.AccessViolationException when trying to use DrawString method of Graphics (part of System.Drawing) object.
So, my question is what is common way to solve this?
Is it even possible to use System.Drawing classes in this multi-os setup?
The same System.Drawing code should work on Linux, Windows and macOS without any changes. You're correct that you need to either manually install libgdiplus (e.g. via brew install mono-libgdiplus) or reference runtime.osx.10.10-x64.CoreCompat.System.Drawing for System.Drawing to work on a Mac.
System.Drawing will work on Windows without any external dependencies.
If you're still using CoreCompat.System.Drawing (which I maintain), I'd recommend you migrate to System.Drawing.Common instead - this the is Microsoft implementation of System.Drawing for .NET Core.
If the issue then still reproduces on Windows, your best bet would be copy a should piece of code which can be used to reproduce your issue, so I can have a look at it.

Monogame UWP - Including a DLL library causes error

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.

Can I use MONO to create a program that runs without the .NET framework being installed?

I need to write something for a Windows XP embedded computer, which does not have .NET installed.
I already have written the program in .NET, so I'm wondering if there's a way to make it run without .NET?
Perhaps using MONO to create some all-in-one .exe?
Thanks for any thoughts / ideas!
Take a look at mkbundle from Mono:
The resulting executable is self contained and does not need the Mono
runtime installed to run.
When running managed code - .NET/Mono assemblies, a framework is required to be installed. Depending on your dependencies, you may be able to run under mono without modification. Mono is compatible with Windows XP. Parts of .NET are not compatible with Mono such as WPF.
Firstly make it run without .NET is an error concept. .net program must run at .net Environment. You can say without .netframework.
If you want to use .netframework, may these can help you:
http://blogs.msdn.com/b/embedded/archive/2007/03/23/deploying-net-framework-3-0-desktop-distribution-package-on-windows-xp-embedded-sp2-runtime.aspx
http://social.msdn.microsoft.com/Forums/en-US/93e39489-2c61-439d-aa3f-865195fb79d7/net-framework-35-on-windows-xp-embedded?forum=embeddedwindowscomponents
Or you can setup monoruntime on this os

Install .Net assembly reference in Mono

I an earlier thread I got some help to track down a deprecated .Net assembly reference and I was successfully able to port my project to build within Visual Studio 2010.
Is there any option to get this ReportViewer to work within Mono? Building the project with MonoDevelp 2.2.2 currently gives me similar errors:
Assembly "Microsoft.ReportViewer.Common Version=8.0.0 [...] not found
Assembly "Microsoft.ReportViewer.WinForms [...] not found
Thanks for all help :)
Try running all of the dependent assemblies through the Mono Migration Analyser. It currently targets Mono 2.6, but 2.8 has recently been released.
If the assemblies pass the tests in that then they'll work fine in Mono. If they don't pass the tests then there's a slim chance that they'll work, it just depends which functionality is used.

Categories