Reputation: 9443
I have an application written on top of .Net framework 4.5
and C#
using Visual Studio 2015 Community
. I created it in Win10
OS in 64 bit
machine.
Is there any possibilities to run this application in Ubuntu
? Then how can I compile the application to make it compatible for ubuntu machine?
I would like to deploy it as a cross-platform application but I have a hard time figuring out the best way. I heard about Mono
but I am not yet familliar with the IDE.
Please help.
Upvotes: 4
Views: 10247
Reputation: 519
Unless you're using special .NET classes or native libraries it should be possible and easy.
Since the .NET compiled executables are built on bytecode, they aren't linked to a specific platform and Mono has been designed with this in mind.
Supposing you've just tested an application named "WindowsApplication", try to follow these steps:
Check under your Visual Studio projects folder, try to locate your WindowsApplication.exe.
Check "C:\Users\YourName\Documents\Visual Studio\Projects\WindowsApplication\WindowsApplication\bin\Debug
(or Release)
After installing Mono on your Ubuntu system check if the mono command is available in your folder (for this test just use your home dir):
username@locahost ~
$ mono --version
Mono JIT compiler version 5.0.1 (Visual Studio built mono)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: normal
(more output)
Copy your program executable from Windows into the Ubuntu folder, let's suppose you copied to the directory where you just tested mono.
Launch it by typing:
mono ./WindowsApplication1.exe
(if it's in your current directory)
or
mono /<another_path_to_your_executable>/WindowsAppliction.exe
In case it didn't run you can download the "Mono Migration Analyzer" (MoMA), which is a tool specifically designed to identify unresolved dependencies and help you solve the problem.
Upvotes: 4
Reputation: 2352
Re. WinForms: In theory this is possible, though you probably want to check the status of the WinForms project to see how cross-platform this is and whether certain tooling such as the forms designer is available and/or stable. If you were starting from scratch you could use GTK# instead which is cross-platform and has good tooling support in MonoDevelop/Xamarin, but that may not be helpful if you've already invested heavily in WinForms.
Re. compiling for Linux: You shouldn't need to re-compile using Mono unless you are making use of any .NET CLR specific features in your code (which naturally wouldn't be implemented in Mono) or you are using e.g. ILMerge in your build process. I'd throw your exe on Linux with the dependencies and test it to find out. If you do end up needing to recompile you can do this on Linux, BSD or Mac OS X using the Mono compilers directly or open the project in MonoDevelop and build it that way; any of these platforms should produce a program that is executable on any other *nix with Mono.
Upvotes: 2