In short, I have a console x64(/x86) C# project that is using .NET Framework 4.7.1. I need to run this project on a Raspberry Pi, some way, somehow.
I tried Mono on Raspbian. Mono worked for some of the project, but failed for two of its key libraries.
Next I tried Windows IOT. This worked well for the most part, but I couldn't run my project. After publishing it and uploading it to the Pi, it says the project is not compatible with the version of Windows I'm running. I think this might only be for .NET Core projects?
Next I tried emulating x86 through Wine on Ubuntu which was just a nightmare.
Finally I tried installing Windows Desktop on the Pi, but it lacks network adapters, and my project needs the internet to function.
What are my other options? How can I do this?
I also had a lot of problems, i have a C# application that needs to be run on arm platform. The solution I found was to make an application in Visual Studio 2012 (a Windows Form Application project), and run on RaspberryPi3 using mono:
mono myapplication.exe
In my case I use only a library of access to GPIO, and other common libraries (xml, json), so it worked fine. It would be interesting if you could quote which libraries didn't work for you.
Related
I have a c# nuget package that uses some native (c++) code, which supports cross-platform development, meaning that when you call the c# nuget from another project, depending on the OS it will either pull the .so files (linux) or the .dll files (windows).
Now I have a console app to test some code (.net core 3), which also calls indirectly the above mentioned c# nuget. I want to build and run this console app in ubuntu 18.04. Problem is, when I build the console app, I get the .so files as expected, but when I run it, the app looks for the .dll files and complains that they are not there (which they are not, so I get a DLLNotFound Exception). Does anyone know why during build time a console app in linux builds with a "windows behavior" ? I guess it has something to do with the way .NET builds stuff in linux.
P.S. : When I use the aforementioned c# nuget as a microservice in a linux environment, everything works fine.
I made a WPF and Console application for someone to use on their private server which I can't have access to. I used Visual Studio 2019's built-in "Publishing Wizard" to create Framework Dependant single-file apps. When the person opened the WPF app they were greeted with the standard warning:
They clicked yes and to my understanding, they installed .Net Core 3.1 which is what the applications target.
After they restarted the computer they got the exact same warning again. I wasn't sure what was going on so I repackaged the apps as self-contained since the installed version of .Net Core was the same as what my applications were targeting.
That seemed to work for a little bit. We ran into some unrelated issues that I had to fix in the code on my end and then I re-published the projects and sent them out.
They tried to use the WPF application and they got the install warning again.
Now no matter what combination of options I pick in the "Publish Wizard" they keep getting the warning.
I'm not sure what to do.
Here's a picture of my publish settings
In my case I had the same issue, and the problem was that I was not deploying the file "MY_PROGRAM_NAME.runtimeconfig.json". After copying this file, which is present in the build output, the application is launched without problems.
Turns out the issue was the fact that the applications were targeting win-x86 and the user only had access to 64-bit runtimes of .Net Core.
For some reason, I thought it would be able to handle a 32-bit version even if it was running 64-bit runtimes.
I guess live and learn.
I am creating cross-platform application in C# using VS2013 and Xamarin studio. I know that questions was asked before, but lately CoreCLR was announced as open source and available on Linux. What I've heard this is not for WinForms or WPF right?
So my question is: What are ways to run .exe application in Linux/Mac OS. I mean legal ways. Is Wine legal without buying Windows? My application is .net Framework 4.0+.
Or maybe i can open my solution in mono develop and compile it in Linux?
EDIT:
Another idea show up in my head. Maybe there is way to change my code (fe: change UI) and then Linux users will be available to open this without any additional software?
And also as i asked before, is Wine legal to run my own application?
Edit2:
So tried to do this on my own, and there is no problem to run winForms application in ubuntu. After install mono and MonoDevelop IDE i was able to run winforms.exe application. This solution gives me another question:
Is there way to run it without installing IDE?
Answer is this:
sudo apt-get install mono-runtime
sudo apt-get install libmono-SYSTEM*
sudo apt-get update
mono application.exe
This will run my application. Probably if someone else got other things than winforms, other packages could be needed.
I know that questions was asked before, but lately CoreCLR was
announced as open source and available on Linux. What I've heard this
is not for WinForms or WPF right
You're right, there's no support for Winforms and WPF in .Net Core CLR. Right now only Asp.net 5(MVC/WebAPI/SignalR) and Native applications support is available.
What are ways to run .exe application in Linux/Mac OS.
I'm not sure what do you mean by that. There are compilers for Linux and Mac OS to run your .Net application on these platforms. As I said above there's no support for win/wpf but there's an Asp.net console application supported in .Net Core that you can try at home.
I have solution with mixed projects: C#, native C++ and CLR/C++ (this also requires some external DLLs). When I used default settings of VS 2012 and targeted for .Net 4.5 it worked fine. But then I had to downgrade it to .Net 4.0.
I succeed by building solution only for 32-bit and forcing C# main project to be built for 32-bit also (usually C# is used for "Any CPU").
With such settings in runs fine on 2 computers out of 3 I have for tests -- meaning on it fails. It claims it cannot load CLR/C++ project or one of it dependencies.
So my problem is how to run it or at least to know what failed exactly? From the list of installed programs I can see that on working computer I have either .Net 4.5 Multi-Target or I don't have .Net 4.5 at all (only 4.0). On computer which fails I have .Net 4.5 (period). So maybe my program tries to load some assemblies from .Net 4.5 instead of 4.0? But that is just guessing.
Question -- how to diagnose such twisted solution and how to fix it?
Install .Net framework 4.0 multi-targeting pack
Check references (including NuGet, if any)
When I encounter a similar problem I usualy check the following:
Do you have Visual Studio installed on any of those three machines? I guess it's installed on the two where your application is running. If so, I'll extend the list later.
Check the target of the C++/CLI project - it should be Win32 if you build for 32-bit.
Run the application without Visual Studio, wait until it fails and go to the Event Viewer to look for some usefull information there.
Get Process Monitor, run the application without Visual Studio, wait until it fails, stop monitoring and filter the list by the application name and failed operations and look there for some usefull information.
I am working on a Mono GTK# desktop app written in C#. I have developed my app using the MonoDevelop IDE (v2.4.2) on a Mac (OS X v10.6.7). My app depends on the GTK# library (obviously) as well as the Mono.WebServer2 library for running a local ASP.NET server.
I have tested my app on my own Mac as well as other Macs. Everything is working out great. Now, I am interested in porting my app to other platforms (specifically, Windows 7 and Ubuntu v11.04). I have been playing around with the mkbundle command but I haven't had any luck in creating a working bundle for other platforms than Mac OS X.
Since I have tried a number of different solutions without success, I would like to hear from the Mono developers out there. What do you do to port your app to other platforms?
I have been developing C# using Visual Studio for a long time but I am new to the Mono development environment. Therefore, I would very much appreciate a detailed explanation.
Thank you very much!
It doesn't really sound like you're talking about porting, rather packaging. MonoDevelop's "Project/Create Package" function can create simple binary packages (zips etc) or source packages (source plus makefiles) but these are not the ideal form to distribute to most end-users. Some additional work is required to make a polished installer for each platform.
mkbundle bundles the Mono runtime into your app, therefore it creates binaries that are 100% platform-specific.
For Mac, the usual way to distribute an app is as an app bundle. MonoDevelop doesn't automate this for GTK# projects, but I explained how to do it on my blog.
For Ubuntu, you can distribute a zip of binaries and require that your users install Mono, GTK# and xsp. If you create a .deb package, you can embed these dependencies into the package manifest. MonoDevelop doesn't have any tools for creating deb/rpm linux packages, and I'm not familiar with the process myself.
For Windows, you can provide a zip of binaries and require that your users install .NET and GTK# for .NET. You could also create a msi installer and have it check for these prerequisites.
It sounds like you have already solved the problem of packaging for Mac.
On Ubuntu, you would want to create a .deb package that contains your app and requires other packages as dependencies (Mono, Mono.WebServer2, GTK#, GTK+, etc). The following link should get you started on building Ubuntu packages:
https://wiki.ubuntu.com/UbuntuDevelopment
For Windows, you probably already know how to build an installer if you have .NET experience. I would say that you would want to run your app on top of .NET instead of Mono. That is what the Mono team do themselves (for MonoDevelop as an example). Bring in the Mono specific bits like Mono.WebServer2 as part of your application.
Your biggest issue here will be that GTK# requires the GTK+ C libraries to be installed. Probably the easiest thing is to detect if GTK# is installed as part of the installer and ask your users to install GTK# if they need it. You are going to have to do the same detection for the .NET version you require anyway. You can get GTK# for Windows here.
I do not have great instructions for doing this but both the Banshee and MonoDevelop projects do it well. I would take a look at those projects as they will show you exactly what needs to be done.
https://github.com/mono/monodevelop
http://git.gnome.org/browse/banshee
EDIT:
I just recently realized that the code for the GTK# installer is on GitHub here.
There are is also packaging projects available in Monodevelop. you can use them.
I'm doubtful that mkbundle work well other than Linux.
Another option that open your project on other plateform (you can use Monodevelop) and build the project and use some other app to build package.
I just recently created deb package of my own .Net project written in MonoDevelop. From MonoDevelop I created a package with sources and makefiles (makefiles also generated by MonoDevelop) and then i used this guide>
http://www.webupd8.org/2010/01/how-to-create-deb-package-ubuntu-debian.html
to create deb package. Dependencies were mono-runtime and gtk-sharp2.