'Trouble Running WinForms Application on Debian 11 Using Mono

I am trying to run a simple Windows Forms application on a imx8m nano SOM board running Debian 11. I built the application on Windows using Visual Studio, SCP'd the .exe from the bin folder over to the board, but whenever I run it with mono {app-name}.exe it gives me this error: Cannot open assembly '{app-name}.exe': File does not contain a valid CIL image.

This is the output of mono -V:

Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  arm64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          yes(610)
        Suspend:       preemptive
        GC:            sgen (concurrent by default)

I believe I have the .NET sdk/runtime installed corretcly as I can compile a simple example with csc {app-name}.cs and successfully run it with mono {app-name}.exe. I installed it with the instructions here: https://docs.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install

I have also tried it with a simple console application and I get the same results.

{app-name} is a filler for the actual application's name.

I also noticed that Debian 11 isn't technically supported on this website: https://www.mono-project.com/download/stable/#download-lin-debian but they say it should work nonetheless.

What can I do to get this application to run on this board?

I was following this tutorial loosely if it helps: http://comfilewiki.co.kr/en/doku.php?id=comfilepi:running_.net_winforms_applications_with_mono:index

I believe the problem is most likely due to my Windows machine running the x86 architecture and the ixm8m board being ARM architecture. I don't have time to test cross-compiling out for a few days, but I will roughly follow the tutorial for the RPi linked above if that is the correct way to do it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source