I have years of experience developing on microsoft development stack primarily visual studio 2012/c#. But right now, im required to develop app on linux. While i know c++, its been years since i really touch that. I have few questions.
Can i develop using mono and compile binary for linux and windows with no code(or minimal) code changes?
Can i develop on windows platform using visual studio 2012, compile for linux on window platform? do i need to use virtual machine for compiling for linux in windows platform?
How do you setup your development environment if you want to develop linux app on windows platform(develop on windows, compile for linux and windows. my linux box use for testing is a separate machine.)
Some info on what im working on.
My project is about network channel analysis. The client is cheap industrial linux box most probably with no ui. Im using mono/c# to develop the client. The server would be windows develop using vs2012 c#. Most probably using wpf as ui. Im planning to share network/communication library between linux(client) and windows(server). My primary concern for using linux is for cost saving since the client is almost thousand units.
thank you.
Mono runs executables in PE (Portable Executable) format, the native file format of Windows. There's no need to "compile for Linux", as long as your app is pure MSIL. And even if you use native DLLs through p/invoke, Mono and Wine work together to run the Windows files on Linux.
(The a.out and ELF executable formats used by native Linux applications don't have mechanisms for storing .NET metadata, the PE format was modified to support .NET, so that's what .NET Framework (not Micro Framework) implementations use regardless of platform)
The most important things to consider at the beginning are,
WinForms of Mono is problematic. Not only most third party controls won't work properly, but also libgdiplus itself is not 100% compatible with Microsoft's GDI+. It might appear to be a sweet option, but later you might still need to fight hard against the incompatibilities.
WPF is not an option as Mono does not support it yet.
GTK# is your best choice for UI, which blends naturally with Linux distros. If you refactor your Windows project properly, you should be able to share the non-UI code between your Windows and Linux solutions. This is what Mono guys recommend (not only use native UI frameworks for Windows, Linux, but also for Mac/MonoMac, iOS/Xamarin.iOS, and Android/Xamarin.Android).
So go back to your questions,
You should never wish for no code change for a real world project. No, that's impossible. As I said earlier, you have a chance to share most non-UI portion.
You can develop the non-UI portion and the Windows only portion using VS2012 and test them out on Windows. If you plan to use Mono's WinForms or GTK#, you must develop and debug on Linux using MonoDevelop. Thus, you need either a virtual machine or physical machine of Linux.
For me, I frequently switch between Linux/MonoDevelop and Windows/VS.
As Mono + C# is much more productive than using C/C++, many successful Linux apps are developed on Mono, such as Banshee and Tomboy.
You can use Visual Studio without problems but for example you cannot use WPF, while Windows Forms are ok. For more information what you can use visit: http://www.mono-project.com/Compatibility
Moreover there exists Mono tools which integrates with VS: http://www.mono-project.com/GettingStartedWithMonoTools
Related
I am completely new to Mono and Gtk#. I'm developing an app on Linux but I want to run it on Windows as well. However, if I build the app using MonoDevelop and then run the .exe file in Windows, it doesn't launch.
Is it really possible to make Windows apps using Linux/Mono, or am I missing something?
Baltasarq is correct. The reason that your app won't run is that the dependent GTK# binaries are not on your target machine. The compiled .exe will run on any .NET implementation so long as it is of at least the .NET version that your executable targets and the dependent assemblies are available.
Like Symon said, you have to build your project on the operating system you're intending it to be be compiled for because of the resources (API's etc.) that specific operating system is loaded with.
When I have a problem like this, I simply use a virtual machine software like VirtualBox or VMware to run Windows and then install and run MonoDevelop inside of Windows. Don't worry about the expensive cost of Windows, for you can just get Windows from Microsoft's website here. There will be a little watermark in the corner of the screen because you didn't pay for the copy, but everything is still totally legal and fit for software development.
UPDATE:
A better method to do this is to install the GTK# dependencies and then recompile the program.
I'd like to create a few simple C# applications and command line utilities to learn more about C#, affordably. Initially, I tried using Microsoft's free Studio Express in a Windows 8 virtual machine; however, it quickly reported that it could only create apps for the Microsoft app store and failed to build the simplest examples of an XML file transformer.
I also found Mono or rather MonoDevelop. I'm still reading about it. It seems that the SDK is entangled with the MonoDevelop IDE, and the MonoDevelop installer is actually the Xamarin Studio installer. Xamarin is a subscription based IDE and inexpensive versions of it appear to be constrained. Perhaps I need to continue studying; however, I thought I'd ask if anyone has experience getting started with C# on OS X.
Ideally, I'd like the simplest setup. I prefer using command line compilers, simple code editors, and build scripts. Are there Windows and OS X command line compilers for C# applications? Are there framework libraries that can easily be included that work on both OS X and Windows?
First, Mono is not an SDK, but a runtime. The specific point of Mono is to be able to, for the most part, run the same IL on other platforms as what runs on .NET for Windows. This means that, barring the slight hiccups in implementation, you could copy a program, run it via "mono program.exe" (via the console) on OS X, and get the same output (I have tested this with Console applications, at least - UI starts to get a little hairier).
In terms of library, the Mono libraries try to mirror the .NET ones so exactly, that the code you write for one is almost completely compatible with the other.
"MonoDevelop" and "Xamarin Studio" are the same thing, simply having applied a name change after a certain version. They are the most well known tools for building in the .NET language family on a non-Windows system (the only tools I even know of), and tend to mirror the shortcuts of Visual Studio well (at least on windows.) Unlike Mono itself, these are an IDE, and do not constrain you any more than VS constrains you into .NET.
The constraints you'll find with free Xamarin apply mostly to their mobile platforms (iOS, Android) and do not affect working with desktop (ie Windows and OS X) applications.
I've settled on using a Windows 8 virtual machine and Visual Studio Express for Windows Desktop as Dan J recommended. For usage similar to mine, simple desktop and command line apps, be careful not to select and install the "V.S.E. for Windows" version.
I was making an OpenGL application with C# and Windows Forms.
Recently I thought about making it cross-platform, I mean to make it run on Windows, Linux and OS X. I have never even tried to make a cross platform application.
I did some research and found that I should use mono. Do applications made with MonoDevelop will run fine all of these platforms without any additional installations? If not, what exactly user will need to install to run that application?
Is there any easy way to write the code once and then build it for windows, linux and os x without requiring the additional installations?
Does applications made with MonoDevelop will run fine on windows, linux, os x without any additional installations?
Well. They will require Mono to be installed on Linux and OsX and the corresponding version of the .NET framework on Windows (or Mono there too).
When developing, you will of course need to keep cross platform concerns in mind (directory separators, for instance, though the Path class helps here), and Mono have created the migration analyzer to help with this - see MoMa.
Now, assuming you kept these in mind and that Mono and or the .NET framework is installed on the end user system, you shouldn't need anything additional to install.
Would it be possible to code and compile C#, on a Windows 8 Tablet (WinRT) (the ARM processor edition)?
Basically it comes down to this:
Is there a C# compiler that runs on ARM?
Is there and IDE that can run in WinRT?
If the above is true, I don't see any issue, but I currently can't find if the C# compiler runs on ARM (only a lot of posts about compiling for ARM). I've also looked at SharpDevelop, and found that their source code compiles for "Any CPU", which according to this post: Windows RT and c#, means that it'll run on ARM.
Sharpdevelop however requires .NET 4.0 "Full" runtime, which I couldn't find if WinRT has or not. I'm betting it doesn't, as WinRT is supposed to be a really lightweight edition of Windows.
As a sidenote, I know that Windows tablets will come in two editions, one for ARM and one for classic processors. The classic processors will run a normal Windows 8 edition, which means it can run all the native applications. Compiling C# wouldn't be an issue here - so the question is rather, can I do the same on ARM?
This would be awesome for travelling and trying out new ideas quickly.
Currently: no, and no.
It would certainly be possible to build a Windows Store app that contains an IDE and a C# compiler. However, you would not be able to run any programs built using such an app. Windows Store apps run with reduced privileges in a sandbox. In this sandbox, the CLR will only load system assemblies and assemblies contained in the app package. The app package is immutable and cannot be modified at runtime.
Actually, the .Net framework on the surface includes csc.exe, the Csharp compiler.
I've gotten code to compile, but WinRt doesn't seem to like it being run without proper signing.
The IDE won't happen for a while, not yet at least. I'm sure that with proper signing, it is possible to run a compiled executable.
Or the other guy might be right and it isn't just an issue of signing.
I've ported SharpDevelop to run on unlocked Windows RT devices, it works at least for C# Windows Forms apps. http://chentiangemalc.wordpress.com/2013/03/18/sharpdevelop-rt-edition-beta-code-windows-forms-directly-on-windows-rt/
I'm looking into Mono and .NET C# and we'll be needing to run the code on Linux Servers in the future when the project is developed. At this point I've been looking at ASP.NET MVC and Mono.
I run an Ubuntu distro and want to do development for a web application, some of the other developers use Windows and run other .NET items with Visual Studio.
What does Mono not provide that Visual Studio does?
If running this on Linux later shouldn't we use MonoDevelop?
Are there some third party tools or add-ins that might be an issue with Mono later?
What does Mono not provide that Visual Studio does?
MonoDevelop is presumably what you mean here. MonoDevelop offers cross platform development on Linux, Mac OS X, Windows based on GTK. However it is not as polished as Visual Studio for obvious reasons - it's 3 people making it, not hundreds. It has some nice features, especially its source control plugin architecture. However as Visual Studio Express is free there aren't many advantages on Windows to using it.
It uses the same .csproj and .sln format as Visual Studio, however the XML docs format is different.
If running this on Linux later shouldn't we use MonoDevelop ?
As I mentioned above, the project formats are inter-operable.
Are there some third party tools or add-ins that might be an issue with Mono later?
Unlike Visual Studio, there aren't a huge wealth of add-ins for Monodevelop. The ones that you use in Monodevelop won't effect your .csproj files at all, as anything Visual Studio cannot read it generally ignores.
As people have said don't confuse Mono for MonoDevelop. MonoDevelop is an IDE for Mono that originally came from (forked) SharpDevelop.
Mono is the cross platform framework that 'apes' the Microsoft CLR and framework libraries.
I don't have much experience in this area but...
The Mono Project Roadmap has an overview of features that are new, upcoming, and not present in Mono compared to MS.NET. Even where Mono has the same classes as .NET, note that compatibility is not 100% (although that is generally their goal). I'm not sure if there exists a comprehensive list of things missing in Mono.
MonoDevelop is now available on both Windows and Linux so you're probably best off using it. However, MonoDevelop does appear to use the same project file format as Visual Studio and SharpDevelop, so you could make an attempt at mixing IDEs.
Of course, when using 3rd-party .NET libraries, note that many of them have not been tested with mono, and in particular anything that uses P/Invoke will not work on Mono for Linux. However, most incompatibilities with mono are minor, and if you stick with open-source libraries you can always fix any incompatibilities you run into.
You might also take a look at Mono Tools for Visual Studio. It lets your visual studio developers target and test with the mono platform.
You're aiming to always have support, and/or primarily use the software on Linux, correct? This is actually a question I asked the Mono developers at a conference a little while back, and it basically boiled down to what you want to do with it.
If you want it to always work on Linux, then use Mono. If you only care about Windows, then use Visual Studio.
If you're using Mono, then use MonoDevelop across all developers. It'll just make life a lot easier later on, and it'll make sure that whatever you write in the one will work for everyone.
Unfortunately, I do not know the answer to the exact limits/advantages of Mono vs. .NET, aside from .NET being further ahead, and Mono playing catch-up, nor about different addons.
If none of your developers need to develop on Mono for certain features, I suggest you all use Visual Studio on Windows. Then test the applications on Mono via
Mono Tools for Visual Studio
manually copy the binaries over
check out the code on Linux and build in MonoDevelop.
Personally I experienced a lot of small troubles when I tried out the third way, but luckily I am capable of finding workarounds.
It is only when you touch Mono, you know which part of your application needs to be tuned.
http://www.mono-project.com/Start
If you can help it, it'd recommend avoiding the Mono implementation of Remoting. There seem to be some unexpected hiccups and debugging it is not straight-forward.
We had a very Remoting heavy product that we tried to port to Mono so we could support Linux. Due to being unable to resolve the Remoting issues, we eventually had to abandon our attempts at supporting Linux altogether.
Caveat: my experiences may be outdated. See comments below
You don't need MonoDevelop in order to run ASP.NET program in Linux, make a shared folder on your development server (VMWare'd or real one), test often so you can easily work-around what's missing from Mono
That's the same approach I'm using in my .NET Remoting program I host on Ubuntu server. But I do the reverse, since I'm a solo programmer, I make a shared folder on my Windows development machine, then access that shared folder on my Ubuntu test server (vmware'd). On ASP.NET stuff, if the changes don't reflect on your Ubuntu test server, in Terminal just touch the Web.Config file in your Ubuntu test server. i.e. touch Web.Config, then refresh the page
Mono has a fully functional implementation of ASP.NET. This includes full support for ASP.NET Web Forms and Web Services. This essentially means that more or less any ASP.NET application that you have developed using with the .NET Framework will work with Mono. Obviously there might be changes needed, such as data access changes, removal of any
reliance on .NET Framework BCL types . Mono- Oracle users-.Net Programming C# : ubuntu 11.04