I'm a complete beginner to mono & c#. I have source code for this public domain windows app that looks like is written in c#. Is it true I can use mono to compile it for mac? Or does mono allow me to run the windows .exe directly on mac? It's been decades since I compiled anything so if someone can point me to where I should start that would be great. Thanks a lot.
Is it true I can use mono to compile it for mac?
Yes.
Or does mono allow me to run the windows .exe directly on mac?
If that .exe is managed (compiled with .NET) and doesn't have unmanaged dependencies, yes too.
It's been decades since I compiled anything so if someone can point me to where I should start that would be great.
Download Xamarin Studio, start coding.
Related
I'm new to Mono development (but not .NET development) - got as far as downloading Visual Studio for Mac and trying to run a sample solution from Alea GPU. It complains that it needs mono64, but I see no option for selecting 64 bit architecture like I would in Windows, and Googling the issue has not turned up an answer I can make sense of. Can I use mono64 in VS for Mac and if so, how?
Since you are running within VS4M, you need to set the architecture of the run configuration that you are using.
Using an ML (Alea-based) program that I wrote as an example:
Within VS4M:
Open the Project Options and go to Run / Configuration / Default:
Open the Mono runtime settings and set the Arch to 64-bit:
From the cmd-line:
Mono is 64-bit by default now, so you can run either:
/Library/Frameworks/Mono.framework/Commands/mono MovieMadnessComputeBoxOffice-Alea.exe
or
/Library/Frameworks/Mono.framework/Commands/mono64 MovieMadnessComputeBoxOffice-Alea.exe
Note: On older version of Mono you would have to have used mono --arch=64 .... If you need arch32, you use mono32, but CUDA only has 64 libs so this would not be needed for Alea usage.
I got mine to work by setting the Project -> Options
to run with 32 bit mono.
it all works, see pics.
I installed MonoDevelop on Linux and wrote a shell GTK+ application. When I compile and run the application shows up correctly in Linux. When I move the .exe over to Windows, I get a crash "Windows Not Responding", so there is no stack trace. Then I figured I had to install Mono For Windows, so I did that, but no luck - I still crash.
More generally, I am having a hard time picturing what is going on here. Please disabuse me of whatever I get wrong:
People who started the Mono project wrote their own compiler (likely from scratch) to compile C# code. They modeled this after looking at the .NET Framework
They also wrote a CLR for their mono implementation of the byte code. Any architecture that wants to run this code will need the Mono Runtime, as only the Mono Runtime can run the code.
Do I have it right? Why doesn't my program run? Thanks in advance.
Three things stand out to me:
GTK+. GTK isn't part of windows or mono on windows by default. You must install it separately.
Shell Application. That means something special in the windows world (an app that runs as part of (extends) the windows desktop shell, rather than as it's own program), and I wouldn't be at all surprised to hear that these don't work cross platform very well or even at all. I'd assume you mean "Console Application" instead, but then why the need for GTK+?
Mono. Make sure you invoke the program using mono. Just because mono is installed doesn't mean that's how your program will run vs Microsoft's own .Net implementation.
Hey, I'm only vaguely familiar with Mono myself but I -think- there is an analyzer tool that will show possible portability issues. If you run through that does it show any issues?
Few things you also check.
Is mono installer contains GTK# libraries.
If yes, check that is the assemblies are in GAC. The assemebiles names be gtk-sharp.dll, gdk-sharp.dll
If no, copy the referenced assemblies in your bin directory. you can see that in your mono develop project.
I assume you mean you wrote a GTK# application. In that case, to run it on Windows, you need to make sure you install "GTK# for .NET" from the Mono Downloads page
On Windows, you can capture a crash dump and see what causes the crash. For example, use WinDbg to execute this application.
http://www.microsoft.com/whdc/devtools/debugging/default.mspx
I was told that VisusalStudio has no version for Mac. So what should I use if I want to develop in C# on Mac ? Anybody has experiences with this ? I'm looking for native IDE, I don't want to run VS using VirtualBox or any virtualization solution.
And if I create application with WPF GUI will it run on Mac ? Or is WPF only for Windows GUI developing ?
MonoDevelop is a free open source IDE based on the Mono project. There's builds available for Linux, MacOS X and Windows.
For GUI development, you'll need to use the GTK+ framework included with Mono - there's no plans to implement WPF on any platform other than Windows. GTK+ is cross-platform, though, so you can compile the same app for MacOS, Windows and Linux if you need to.
EDIT: It appears MonoDevelop also supports WinForms - http://www.mono-project.com/WinForms
There are a couple of alternative IDEs but nothing comparable to MonoDevelop in terms of features - but you can always just write C# code in your favourite editor and compile it using the Mono build tools, of course.
WPF can run on any environment that supports it in its runtime environment. Currently that is only Windows since the Mono project has no plans to implement WPF
Check out the Mono Project.
For an IDE check out MonoDevelop.
You can also check out the MonoTouch to develop to the IPhone.
As already mentioned WPF isn't supported but they do mention an alternative:
Silverlight implement a subset of the
WPF APIs and is available on Windows,
MacOS X and through our own open
source effort Moonlight it is
available on Linux and other Unix
systems.
As far as I know there is no complete IDE that support C# with intelli sense, etc.
So Vmware Fusion + Windows including Studio in Unity mode will be it :)
Simple C# syntax highlighting you can get with textmate.
Could you introduce me a development environment you recommend for C# on Mac?
You want Mono for OS X. Download page. And for an IDE, MonoDevelop.
I migrated some months ago from windows to mac.. it's been a long while since the last time i logged into windows, and I was a C# freak.. so back on mac i tried using Mono, and.. i was really dissapointed because it's not like in Windows: you have a weak IDE to work with and it seems so.. poor! Then i decided to make the big step and switch to objective-c and Cocoa! And now i'm happy again as i was on windows. So, my point here is if you wanna keep going with C#, stick to the windows platform.. but if you want to develop mac apps, try moving to objective-c and Cocoa!
You can also try WINE thats sort of emulator for windows programs on Mac/Linux and you can try installing .net and SharpDevelop tools, and use mono to create output, the benefit is you will get little rich tools to do your development.
TextWrangler + Mono
Parallels + UltraEdit + command-line compilation
Parallels + Visual Studio
I'm downloading MonoDevelop now, haven't tried it in awhile.
I use VMWare Fusion to run Visual Studio in a Windows virtual machine. I'd only recommend this if you've got a fast Intel processor with at least 4GB of ram.
Fusion also offers a "Unity" mode so that Visual Studio would look like it's being run as a native Mac application. A great concept, but in practice it uses way too much RAM and processor.
Otherwise you could use boot camp to run Visual Studio in Windows. This gives you the full strength of your hardware resources but you have to boot to use it.
How do I start using Mono in Linux as a beginner when I want to switch from Visual Studio?
Is there some easy way to install it like Visual Studio and get started?
So far,with what I've seen,it looks complex to even get started.
Installing and configuring Mono in linux is a lot of work right?
or Is there some distro which I can directly install and get started with applications in Linux?
I recently started to dabble in Mono myself and have so far realized that the MonoProject has made huge advancements in this area. It's well worth it to investigate.
With that said, the easiest method is to get setup with a Linux distro that is Mono friendly such as Suse, or Ubuntu. Personally, I tried it using Ubuntu 8.10.
Once you've got your Linux distro setup properly download and install MonoDevelop. This is an open source IDE that's tightly integrated to work with the Mono platform. MonoDevelop was taken as a branch of SharpDevelop and designed to work with the Mono compiler from the ground up.
This is by far the easiest and fastest way to get setup with Mono. The MonoDevelop IDE is very similar to that of Visual C# Express even. It comes complete with Project/Solution management, GUI development using the GTK# framework, an integrated debugger and a host of other features you would expect in an IDE such as code-completion, line numbers, code-folding etc.
The folks at the MonoProject are on to something with this suite of tools.
Hope this helps you get started.
Mono Project Homepage
Mono Develop Homepage
There are a few interesting books on Mono, although they're probably a little bit old. Still, probably it's worth to grab one and take a look in order to start up.
Practical Mono
Mono: A developer's notebook
Cross-Platform .NET development
Mono Kick-start
Then, I'd install latest Mono (2.4) on a Linux box (OpenSuse is the one they use, so it will always go smoothly for development, but we also use Ubuntu internally) and start playing around with the compiler, MonoDevelop (which is quite good since 2.0) and so on.
The only tough point will be writing GUI applications, although my team make extensively use of MWF on different Unix flavors. But everything else will go as you'd expect. I'm specially happy with how great remoting works, for instance.
If you're used to Linux then it will be much easier, otherwise I'd also recommend you getting used to it following some tutorial.
Remember tools such us NUnit and NAnt will be also available, so you can start writing your code on both Windows and Linux and testing and compiling on both platforms.
With the just released Ubuntu 9.04 a very current Mono development environment is as close as:
apt-get install monodevelop
I used to agree with you that it was somewhat difficult to get going with Mono, but the latest version of Ubuntu has melted that barrier away. And the latest version of Monodevelop is an absolute joy to use.
Don't use Ubuntu? Then I would go with Peter's advice of using a VMWare image.
For a very easy start with mono under linux u can download
a vmware image
a linux live distro
with everything included to start.
If you are accustomed to using visual-studio, you can still develop in Visual Studio, and copy your binaries to Linux/OSX or whatever. Or even better, if you have a shared drive, just reconfigure your VS-Project output directory to the shared location.
There might be advantages to using the mono compiler, or monodevelop, but since you are getting started, the above is really the easiest thing to do. If you want to run on Linux, the mono installer is an excellent option for getting up and running in a hurry. Unfortunately, there's no installer available for the newest mono release, so you'll either need admin permission, or need to compile from source.
http://ftp.novell.com/pub/mono/archive/1.9.1/linux-installer/2/mono-1.9.1_2-installer.bin
For installing newest Mono 3.2.5+ with MonoDevelop 4.2.1+ it is better is use tpokorra repository.
The simplest way I could find is to download the OpenSUSE VMWare Image on their site and just run it. You get all the tools you need :) Preconfigured.
Debian and Ubuntu, and probably all other children, have mono in the repository. So, setting up mono in Linux can be as easy as
aptitude install monodevelop
However I would suggest version 2 which requires using the 'sid' repository in Debian (don't know about Ubuntu).
vim /etc/apt/sources.list [ :%s/squeeze/sid/g ]