Run .NET exe in linux - c#

Is there any way to run the .NET exe (of a winform app) in Linux without building the code in linux? In fact I don't have the code for some of the utilities I developed earlier and would like to run them in linux.
Related to : Feasibility of C# development with Mono

Mono ! http://mono-project.com/Main_Page
Works great too. There's a growing tool support, C# compiler etc
in a growing community.

You can test it by using the Mono Migration Analyzer or by actually testing it using the Mono command prompt...covered in this article

Wine + .NET

Related

Can I run a C# application on a Raspberry Pi?

I'm working on a project that means that I will need a Raspberry Pi; however, I have very limited programming experience in Python or Lua.
Is it possible to run a program compiled in VS2013 using C# on a Raspberry Pi?
You can use VS2019 to compile your C# application to .NET Core 3.1.
Once your application is compiled open the directory with the .csproj file in command promt. type in dotnet publish -c release -r linux-arm in command promt. put the compiled files onto the pi then open a terminal window on the py and type chmod u+x <YourProjectName> then ./<YourProjectName> Enjoy!
You can run Mono on your Pi, then develop in C# if you want.
http://www.raspberry-sharp.org/eric-bezine/2012/10/mono-framework/installing-mono-raspberry-pi/
Yes, although you have to use the mono framework to basically emulate .net, it works for most method calls but not all.
Have a look at
http://logicalgenetics.com/raspberry-pi-and-mono-hello-world/
You can install Windows 10 IoT: https://learn.microsoft.com/en-us/windows/iot-core/tutorials/rpi
Or supported Linux and last version of .NET or .NET Core
https://www.raspberrypi.com/software/operating-systems/
If you install the mono framework and follow their guidelines there's no reason your application won't run (obviously within the limits of the framework and hardware). There are quite a few resources on it. I've seen it done in a demo without too many problems.
Writing on the pi would be harder!

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

MonoDevelop for .NET application on Linux

I need to develop C# applications, but i use Linux (ubuntu), I found MonoDevelop, but I don't understand if i can write .NET applications from Linux to use on Windows, so the development on linux and the execution on Windows. are them compatible?
On the Mono website I found:
Mono is a software platform designed to allow developers to easily
create cross platform applications.
What does it means? Can I write on Linux c# applications that can run wherever the .NET framework is installed?
Thank you for the clarification
Any C# code you compile from MonoDevelop or anywhere else can be run on any platform with either Mono or the .NET Framework. As long as the linux system has Mono installed, it can run any compiled C# application, including .exe's copied from a Windows machine.
The reason for this is that when you compile a C# application, it's not being compiled to native system code, it's being compiled to CIL. When you run the program, it automatically JIT compiles your code for the system it's running on, leaving the original executable intact. Both the .NET Framework on Windows and Mono on everything else can read and compile the CIL bytecode.
And one thing to keep in mind, Mono doesn't have the entire .NET Framework stack available. Almost all of the BCL is intact, but libraries like WPF are not available on Mono. Mono recommends you use GTK# for your GUIs.
Yes, you can use mono to create .NET applications that will run on Linux, Windows and Macs.
Mono is:
It is an open source implementation of Microsoft's .Net Framework based on the ECMA standards for C# and the Common Language Runtime.
This means that so long as you don't write code that is platform specific, you can run it on all platforms that .NET can run on. (So, instead of concatenating paths using \ or / you use Path.Combine, and instead of hardcoding linebreaks as \n you use Environment.NewLine and such).
Another advantage is that the mono development tools are free. (see: http://www.mono-project.com/Main_Page)
You can indeed write .NET code in Mono on Linux and run the application on Windows, Mac OS X and Linux.
But keep in mind that the full .NET stack is not available for you. Most noticeable is the complete lack of WPF support.
You can as long as you are careful to not assume anything about things like file system layout and use libraries that are also portable. Graphical interfaces in particular are problematic: Windows.Forms looks alien on Linux, and Gtk may feel a little out of place on Windows.

Sharp develop in ubuntu

Is it possible to compile C# in ubuntu using sharpdevelop?
I am searching for an alternative for monodevelop
Nope, you'll need to use MonoDevelop. SharpDevelop is Windows-only and not supported on Ubuntu.
But you can help with the MonoDevelop project to make it better.
As far as I know SharpDevelop is using a lot of win32 calls, this is why is not 100% percent a .net application and runs only on windows.
It would be possible to run under wine, the information on WineHQ AppDb is very old about it.
I had try with wine debian version 1.0.1-3.5 and it was not possible to install dotnet40 using winetricks, when try to install the msi installer for SharpDevelop it fails with the message that "This setup requires the .NET 4.0 Full Framework to be installed"
I'll try using a newer version of wine and comment here what happend.
OT: MonoDevelop is a great solution, it could be even better if has one competitor in the Linux environment.

Mono on VS2010?

I want to start doing a cross platform project that will run on Linux and Windows.
I went to mono's website to check things out as I heard mono allows me to run c# on Linux, but when I arrived there http://mono-project.com/Main_Page I was a bit confused.
The download page allows me to download it just fine but in order to program mono on VS2010 I need to pay for mono-tools or are there any alternatives within VS2010 ?
In short what do I need to be able to use mono with VS2010 and what are the alternatives to programming mono without VS2010 ?
You can develop in Linux using MonoDevelop.
You can also develop on Windows using Visual Studio 2010 Express Edition, and target the Microsoft .NET Framework. You can then run your assemblies through the Mono Migration Analyzer (MoMA) to make sure they'll run successfully on Linux/Mono. Since Mono uses the same standard IL as the Microsoft framework, the application will run unchanged on Linux, provided you stick to supported portions of the framework.
You don't need to do anything special in your .NET development in order to use mono (aside from writing compatible code). Mono is simply a free implementation of the .NET framework, which will simply run applications written for .NET, regardless of underlying OS platform (i.e. Linux).
Basically, you just need to develop your .NET application as normal, and then you can run that application on mono if you so choose. Since Mono is it's own implementation, there may be some differences, and you can use the Mono compatibility tool to ensure that the .NET code you've written is compatible with Mono's implementation of the .NET framework.
You may also want to download a VMWare image of Mono or something similar if you'd like to spin up a Linux virtual machine for testing of how your application actually runs on a Mono-enabled machine once you've started development.

Categories