1
votes

I'm trying to lunch program RPI_test.exe on Raspbarry PI under Raspbian and Mono project.

My mono version :

1 pi@raspberrypi ~/Documents/bin/Debug % mono -V

Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-10) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: normal Notifications: epoll Architecture: armel,vfp+hard Disabled:
none Misc: softdebug LLVM: supported, not enabled. GC: sgen

Raspbian version :

pi@raspberrypi ~/Documents/bin/Debug % uname -a

Linux raspberrypi 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l GNU/Linux

I get an unhandled exception when I'm trying to lunch the program :

pi@raspberrypi ~/Documents/bin/Debug % mono RPI_test.exe

Missing method SetCompatibleTextRenderingDefault in assembly /home/pi/Documents/bin/Debug/RPI_test.exe, type System.Windows.Forms.Application

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Project is compiled under .NET 4.0 framework. I don't know what can be done with this. I'm quite new in raspberry pi and linux. Am I doing something wrong ? Can anyone help me with this problem ?

Thanks

2
Is it a Windows Forms application (with a GUI) or something that runs in the console? Did you compile the program on the PI or elsewhere?Mourndark
It is a WinForms simple program which I compiled on Visual Studio 2013 community on my other computer (Win7) and then I sent it to raspberry via WinSCP. I sent whole bin directory and lunched it there.Dear Deer
OK, this is a tricky one. As you've discovered, Mono doesn't mean that .NET programs will "just work" - a lot of the DLLs (WinForms included) need special versions. You'll need to compile your code specifically for Mono - have a look at xbuild, that should do what you need.Mourndark

2 Answers

1
votes

This kind of problems usually happen when your Mono does not have some dotnet library installed. You need to install donet system-windows-forms lib for your Mono (on Raspbian):

apt-get install libmono-system-windows-forms4.0-cil

If you application under Mono does not run because some another library is not found you can see all available libraries for Mono here.

0
votes

Get the latest mono version from http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives. The version from stable debian is too old. I had good results with this version using GUI winforms developed in VS 2012.