Deploying Mono applications to Windows - windows

What difficulty would be encountered in deploying a Mono-based application to Windows?
Does the Mono runtime have to be installed along with the application? Would this be an inconvenience for the end user?
Edit: The idea is to deploy a cross-platform application, thus Mono as a choice.

Mono is an implementation of .NET. As long as you don't use Mono-specific APIs, it should be 100% compatible.

As #duffymo said you are probably better off requiring .NET vs requiring Mono. However, there are some scenarios where using Mono makes sense. In particular, if you use mkbundle to create an assembly without a requirement that Mono is installed. There is even a way to statically link the runtime into the exe although this brings along some licensing requirements that need to be considered.

As long as you're sticking to managed code in your application and the there is either .NET or Mono installed, you should be fine.

If Mono is a Linux version of .NET, wouldn't deploying an app developed on Linux with Mono on Windows simply mean taking your source/package and deploying it on Windows? Shouldn't the .NET pieces that need to be common already be available on Windows?

Related

Visual Studio and NuGet targeting Mono on Linux

I build a lot of packages that have cross-platform targeting. I like using NuGet as a deployment for all of the obvious reasons, but I'm having difficulty understanding how I target a specific binary for Mono on Linux.
As an example I have a library that, in the Mono for Linux version, references `Mono.Posix.Helper.dll. This is very specific to Mono on Linux. It's not for the desktop. It's not for Mono on Android or Mono on iOS. The same library has different implementations for .NET of the desktop, .NET on Windows CE, Mono on Android and Mono on iOS.
It seems that I need two things, neither of which I can seem to find:
A way to tell NuGet that a specific set of binaries targets Mono on Linux. I see nothing in the official documentation of the NuGet schema target frameworks.
A way to tell Visual Studio that my project that will consume those binaries targets Mono on Linux. I've found this nice list of project GUIDs but, of course, there's nothing in there for Mono that isn't targeting Android or iOS.
Right now I'm solving this with a less-than-friendly post-build task, but that's really not fun when I need to create a new project that uses one of these packages.
I know Microsoft has been trying to get more Linux-friendly over the past few years, but this seems like a pretty big hole. I can't be the only person out here that's building code for Mono on Linux, can I? What's the solution here?
Currently, this isn't possible.
NuGet (3.*, 4) does have a concept of "runtimes" but those are referring to the operating system that the "runtime" runs on. So while you can have a specific asset for linux-x64, this cannot tell if you are on mono or .net core. In fact, even when you use a net461 target framework with a runtimes/linux-x64/lib/net461/linux-specific.dll file, this may even be used in a .NET Core 2.0 app since .NET Core 2.0 can use net461+ libraries.
The only way this is currently possible is to have managed shim that resolves the right assembly on runtime. This would also make the consuming project "portable" - meaning it can be run on windows directly and on linux through mono, assuming all libraries can be loaded dynamically.

Does Linux have anything equivalent to Microsoft .Net other than the Java APIs or .Net for linux

The international manufacturing company that I am working for is considering moving from Windows to Linux. The only reason for this that I am aware of is that the Windows automatic updates occassionaly cause some of their applications to fail. Apparently, they do not know how to turn this off. What other reasons they may have, I do not know (cost, the mobile phone effect?). My question is does Linux or some popular variant of Linux have a development environment equivalent in power and functionality to Microsoft .Net other than what Java offers, the Linux version of .Net (Mono) offers, or running Windows as a virtual machine on Linux?
It's kind of unclear what you are looking for... a Mono IDE that runs on Linux?
Have you looked at http://monodevelop.com/ ? It's not Visual Studio, but it's really not bad as IDE's go, and I think it's cross-compatible with VS project files. Should be packages available for any major Linux distro -- I know all the Debian based ones have it.
Mono's API is pretty compatible with .NET, though there are differences in some of the supporting libraries. There are apache extensions to do ASP.NET, but they are fiddly to get set up correctly.
It's a usable platform though, and it's possible to write Mono code that's 100% .NET compatible if you stay away from certain assemblies that haven't been ported yet.
I know I am 9 months late. You may have found your solution. You may look at IronPython.

How to development in Visual Studio and then deploy apps to Linux machine

How to develop app in Visual Studio and then deploy apps to Linux machine (OS - Ubuntu, web server - Nginx). Can any explain the steps, it will be a great help
I would say that there are three ways how you can develop apps for Linux using mono.
First is using only Visual Studio for development and from time to time deploy your app to Linux to see potential issues. I personally use this scenario because it's simple and when you are not messing with MS specific stuff or yet fully unsupported things then you shouldn't have problems (at least I didn't so far). Disadvantage is that you will discover mono specific problems only during runtime on Linux machine.
Second approach is using Visual Studio with Mono Tools. I tested it when it was in beta and it was sometimes quite handy (you will move the phase of discovering mono specific problems to your dev environment, however you can still have some certain issues on Linux machine), but since this tool doesn't support debugging for now I don't use it personally.
Third approach is to use only MonoDevelop on Linux (since debugging is now supported only in Linux). With 2.2 release this IDE becomes really good and suitable for development however I have tested only console and basic ASP.NET MVC apps so I can't tell you if it's ready for bigger projects.
Deployment to Linux is quite easy - I just installed proftpd on Linux machine, configured it and copied project there from Windows machine.
If you are developing an application for Linux in C (as Nginx is) or C++, you need to develop on Linux.
There are many IDEs for Linux that you can use for this.
You can also try to run Visual Studio in Linux using Wine.
Use Mono on Windows and compile your apps with it , I guess Apache is only supported ... Disclaimer - I do not have personally experience with it ...

How to rapidly develop Windows applications that don't depend on other runtimes?

I'm a C# developer and I see how .NET makes developing Windows applications easier. Type-safety, memory management and a great IDE are but a few things that make developing .NET applications a breeze. Unfortunately these applications require the user to install .NET framework before they install the application itself. This can confuse the users and scare away potential customers.
Is there any other development environment that would allow one to develop Windows applications as easily as in C#, but without the requirement to install other runtimes beforehand?
Embarcadero Delphi is another good candidate http://www.codegear.com/products/delphi
There also is a free multiplatform Delphi-alike, Lazarus, see http://lazarus.freepascal.org
less polished but free and quite powerful. (source code compatible to Delphi to a very high degree)
Have you looked at RealBasic yet?

What's the best setup for Mono development on Windows? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed last year.
Improve this question
I started trying to play with Mono, mostly for fun at the moment. I first tried to use the Visual Studio plugin that will convert a csproj into a makefile, but there seemed to be no version available for Visual Studio 2005. I also read about the MonoDevelop IDE, which sounded nice. Unfortunately, there's no pre-fab Windows package for it. I tried to follow some instructions to build it by combining dependencies from other semi-related installs. It didn't work, but that's probably because I'm a Windows-oriented guy and can barely spell "makefile".
So, my question is this: What's the lowest-energy way to get up and running to try some Mono-based development on Windows?
I'd recommend getting VMWare Player and using the free Mono development platform image that is provided on the website.
Download Mono
Setup time for this will be minimal, and it will also allow you to get your code working in .NET and then focus on porting issues without a massive hassle of switching machines and the like. the VMWare Player tools will allow you to simply drag and drop the files over to copy them.
I'm looking to take a couple of my .NET apps and make them Mono compliant, and this is the path I'm going to take here shortly.
A year later and the answer to this has change greatly. You can now use MonoDevelop on Windows, or if you are more comfortable in Visual Studio you can use the Visual Studio Tools to write everything and then debug on in VM to make sure it is working on Linux.
#Chris I have found that Visual Studio is the best IDE for developing against .NET -- I think the best way to target Mono is really just to develop and build in Visual Studio under Windows then just run those binaries directly on Linux (or whatever other Mono platform you are using). There are free versions of Visual Studio if licensing is a concern. If you are developing under Linux, the best software is probably Eclipse with a Mono plugin (see The Mono Handbook - Eclipse for installation instructions) but keep in mind it doesn't have near the amount of features or language integration Visual Studio has.
#modesty Mono is a 3rd party open source implementation of the .NET framework which allows you to run .NET applications on platforms other than Windows.
One of the best things you can do if developing with Visual Studio for Mono is to get MoMA http://www.mono-project.com/MoMA. This will inspect any number of assemblies that you build and generate a report showing potential Mono problems (e.g., methods not implemented in the mono library). It can be run from a GUI or the command line for use in automated builds.
Miguel had a post about debugging Mono running on linux with remote debugging on Visual Studio. This may be something you want to look into... Using Visual Studio to debug Mono. There is also a new project called CloverLeaf whose goal is enabling debugging Mono on Windows in Visual Studio.
There's just no reason to build your app using Mono; the whole point of the .Net CLR is that the compiled output is cross-platform.
So you can simply build it using your favourite IDE (and if you like IDEs, Microsoft's is the best one to use) and then test it on Mono. Even if you get Mono working on Windows, it wouldn't be a very good test of your app's portability: what if your app does silly things like assuming filenames have backslashes in them, or that there's something special about a folder called Program Files? The best way to do portability testing is to actually test your app on the target platform.
And that's pretty easy to do with a Linux VMware player like the one at http://www.go-mono.com/mono-downloads/download.html.
Personally, I'm just compiling in Visual Studio 2008 as if it were for .Net 2.0 and then running in Mono (VS2008 on Windows in a VirtualBox, Mono on OSX). All the problems come up at runtime, anyway, so the system works perfectly.
I just found this very new link, which is amazing and shows you how to set up Visual Studio 2008 for Mono.
At the same time, setting up Mono on OpenSuse or Ubuntu inside a VirtualBox (Sun's product) is easy, painless, and doesn't force you to abandon whatever platform you normally live in.
This is not relevant to your question, but I might note that I just got into Mono and I'm amazed at how much of .Net is implemented, including much of the Winforms stuff.
My first instinct would be the rather unhelpful "Install Linux". You are somewhat swimming against the current to try and develop in mono under windows. Installing GTK and everything is a bit of a bother in my experience.
If you do feel like using linux, then you could Try Ubuntu
Otherwise:
There's some information here: http://www.mono-project.com/Mono:Windows and it seems the cygwin toolchain might be your best bet. I don't think you're going to be able to avoid makefiles, sadly. I found a slightly more explicit tutorial from O'Reilly.
#modesty: Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix. Sponsored by Novell (http://www.novell.com), the Mono open source project has an active and enthusiastic contributing community and is positioned to become the leading choice for development of Linux applications. -- From the Mono site.
Eclipse plugin for Mono is dead. On Linux use MonoDevelop or X-Develop if you like good commercial support (although MonoDevelop is closing on them fast feature-wise). On Windows SharpDevelop has custom MSBuild targets for compiling the code against Mono.
As Mono and MonoDevelop are changing fast, be sure to use the latest released versions, even if they are not marked as stable yet (e.g. versions shipped with stock Ubuntu are terribly outdated).
The VMWare image is a great way to start testing Windows-developed code on Linux. Don't touch cygwin unless you are already very conformable with it.
I liked the idea of trying to use MonoDevelop mostly just to make sure my stuff would work against the Mono runtimes. I guess it would also be possible to get crazy with msbuild and write some custom targets that tried to build against Mono, but that's basically emulating the now-defunct plug-in's functionality which I assume was non-trivial to build. I do have minor experience with cygwin, and I am happy typing "configure" and "make" all day long, but when a problem occurs in that process, I'm virtually screwed. I'll probably try to play with all this again, but if it takes me more than a couple hours to come up with a way to build comfortably against the Mono runtimes, I'll probably just bail.
I will try the Eclipse idea. I use that for Java, so I might be able to get the c# stuff to work. We shall see...

Resources