views:

292

answers:

8

Two Questions:

  1. Is there any way to write cross platform programs on Microsoft Visual Studio?

  2. If there isn't then could I write a C# application on VS2008 and recompile it with MonoDevelop and have it work?

+4  A: 

You can always use C++ and QT. Soon QT will be released on LGPL license (from version 4.5) that will give some more freedom.

The only limit of using free QT license is that you don't get integration with VS. However this can be handled by using eg. CMake (which will generate VS solution files).

Marcin Gil
+1  A: 

You could ideally write a C# application and have it run on the Mono platform. BUT, that will depend on the libraries of MS .NET that has been ported yet to Mono.

Just in case, there is no language constraint, you could consider using other languages like Java, Python, Ruby and the like..

Good Luck!

Amit
You can run Mono on Windows to check if you don't have another box linux/osx.
kenny
+5  A: 

1 - I dont' think so. Not without something like Mono.

2 - Yes you can, but Mono doesn't cover all the framework - they are working on it. The best thing to do is check with the Mono Migration Analyzer. The Mono Migration Analyzer (MoMA) tool helps you identify issues you may have on Mono - http://mono-project.com/MoMA.

I have found most of my .NET 2.0 applications can be converted, but you may need some tweaks.

Joe R
Another good resource is the portability guide http://www.mono-project.com/Guidelines:Application_Portability
it depends
you don't need to recompile with MonoDevelop to have it work on mono.
trampster
+2  A: 
  1. Yes, Write your code, compile and run on another platform using Mono. When you compile you generate IL, which Mono can use. Note: Some functions aren't available on Mono. Delphi Prism, is an add on for Visual Studio which allows you to code to Linux and Mac from VS albeit in the object Pascal language though.
  2. Yes, see same issues as in 1
Robert MacLean
+2  A: 

I agree with Joe90, just one thing he left out: MonoDevelop can compile .sln and .csproj files because it has a MSBuild implementation.

So point MoMA at your code and if you get a green light it should compile as-is in MonoDevelop.

As a MSCLR junkie I have to admit that Mono has a few 'better' implementations of certain critical functions (mostly to do with encryption). You will get more usability power from these.

Another thing to watch out for is subtle logic errors. If a class is implemented in Mono it does not mean that it will behave the same the MSCLR one (Mono is a cold-room implementation and as such they DO NOT use the original source code). This is really where you will get good results from a well unit-tested code base.

For a good indication of what you should expect, I remember seeing a large amount of #if MONO in the AgsXMPP repository.

Jonathan C Dickinson
A: 

As many others mention your success will depend on the libraries you use. Mono does have Winforms but I would suggest that you also look at GTK# http://www.mono-project.com/GtkSharp as your windowing library. If you use GTK# you will use a library which is not reverse engineered (as Winforms is in Mono).

My understanding is that "non-gui" .NET 2.0 stuff is pretty much in place with the newest versions of Mono

Michael Jacobsen
A: 

You don't need mono develop, the whole idea of mono is you can develop for .net and have the same assemblies work on both mono and .net, provided you only use stuff which has been implemented in mono.

Stuff which won't work: pinvoke, wpf, linq to SQL

Stuff which will work: .net 2.0, c# 3.0 (including linq to objects and linq to xml), winforms

trampster
A: 

If you write your application in Silverlight, anyone with a web browser and the Silverlight plugin can access your app. This is as cross-platform as you're going to get with .NET.

davogones