Slashdot Mirror


Creating .NET C# Applications for Linux

An anonymous reader wrote to mention an article on the IBM site entitled Mono brings .Net Apps to Linux. From the article: "Mono gives open source developers the programming power and flexibility to build applications for Linux while maintaining cross-platform capabilities, using a variety of .NET-compatible languages. One of the great advantages of Mono for current .NET developers is providing an easier migration path to Linux. The Mono project has a very open and active development community and provides both developer tools and the infrastructure needed to run .NET client and server applications. Perhaps the most important benefit of using the Mono architecture is that you gain language independence. Mono lets you leverage any existing code from languages supported in the .NET runtime. "

26 of 340 comments (clear)

  1. Not really news... by Momoru · · Score: 2, Informative

    Mono has been around and kickin' for almost as long as .NET has been. It still doesn't execute .NET 100%, but definitely something to check out if your a .NET person and want to use Linux.

  2. C# is an open standard by Sycraft-fu · · Score: 1, Informative

    ANSI controls it. No changes can be made without submission to ANSI, and those chances will be made public. Sure, MS could make another language based on C# but not compatible (so could anyone else) but then it won't be C#.

    1. Re:C# is an open standard by The+Bungi · · Score: 3, Informative

      It's ECMA, not ANSI.

    2. Re:C# is an open standard by mozingod · · Score: 2, Informative

      That's the problem. C# is open and can be completely cross platform, but .NET isn't. To me, though, the greatest part of using C# is having the .NET framework available to you. Mono is having to recreate the .NET framework on Linux, while Java's framework is already there (though not open source).

      I'd rather use Java and have its full framwork available to me than use C# and a crippled, albeit quickly catching up, .NET framework. Six of one, half dozen of another, I suppose.

  3. Re:wxWidgets vs. Qt vs. Windows Forms by CyricZ · · Score: 2, Informative

    wxWidgets is LGPL. You should be able to dynamically link to it while still licensing your software as you see fit. It may have a static linking clause, allowing you to link statically instead of only dynamically. You'll want to check on that, though.

    What about using FOX? It's far lighter than wxWidgets or QT, while still offering a decent cross-platform GUI. And it's LGPL, with static linking exceptions.

    --
    Cyric Zndovzny at your service.
  4. Re:.NET Windows Forms by MooCows · · Score: 3, Informative

    Mono implements System.Windows.Forms, but currently it's not stable.

    It's recommended to use the latest build of Mono System.Windows.Forms, you can find it here.
    And here is the the Mono WinForms class status.
    I currently wouldn't rely on it. But the outlook is good.
    And here are some pretty pictures of Mono's WinForms in action.

    For apps where the both compatiblity with Windows and Linux/OSX are important I'd use wx.NET.
    However on Win32 WinForms works best, even if it isn't the nicest (for developers) toolkit around.

    --
    The path I walk alone is endlessly long.
    30 minutes by bike, 15 by bus.
  5. Re:let me get this straight ... by Decaff · · Score: 2, Informative

    Perhaps Java will be a more useful option once GNU Classpath matures a bit more, and GCJ support under Windows is improved.

    This will be news to the thousands of developers who are already using Java under Linux and Windows for application development right now! If you look at the IT job market (Java being the most required skill for commercial application development), you won't see Java uptake being held up because it is not currently a 'useful option'!

    Personally, I can see the advantage of a mature open source Java, but Java is not being held back by this.

  6. Re:I'm sorry by hkb · · Score: 1, Informative

    But just use Java.

    We do, sometimes, when we're forced to, but Java IS slow (don't bother quoting any BS benchmarks.

    Why play second class citizen in some one elses world. Java was designed to be cross platform from day one and is really supported on all platforms.

    Uhm, .NET and Mono were designed to be cross-platform from day one, too. MS didn't decide to use MSIL for the hell of it. It was designed for portability.

    Mono is also supported on just about every relevant platform, except maybe in the mobile and embedded spaces. But don't kid yourself, Java isn't exactly "good" in these spaces, either.

    And I'm not too sure Mono/Microsoft are exactly second-class citizens in Java's world. They're kind of carving their own niche.

    --
    /* Moderating all non-anonymous trolls up since 2004 */
  7. Java has language independence too! by TheNarrator · · Score: 4, Informative
    Perhaps the most important benefit of using the Mono architecture is that you gain language independence.

    This is by far the most hyped feature of C# but it's also present in Java. If you look at the large incompatibilities between Visual Basic and VB.NET you'll see that .NET is not really that language independent and that each language is really more of a "skined" version of C#.

    As far as alternative languages go in Java there are many. Among the most popular are: JRuby
    # interpreter written in 100% pure Java
    # Most builtin Ruby classes provided
    # Support for interacting with and defining java classes from within ruby
    # Bean Scripting Framework (BSF) support
    # Distributed under a tri-license (CPL/GPL/LGPL)

    Jython (Python)
    Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

    Groovy
    Groovy is an agile dynamic language for the Java 2 Platform that has many of the features that people like so much in languages like Python, Ruby and Smalltalk, making them available to Java developers using a Java-like syntax.

    There's a lot more smaller projects like JavaScript and Rhino, Jelly, BeanShell, Tcl/Java, Sleep, ObjectScript, Pnuts, Judoscript. Some people event think there are too many alternative languages for the Java Virtual Machine.

  8. Re:Where are the apps? by Decaff · · Score: 3, Informative

    While Java is often suitable for enterprise apps or web based apps, it just isn't useful for consumer-grade application development

    That will be news to the many developers who have produced such applications. Go to the Swing Connection on the Sun Java Website and you will see hundreds of applications that are consumer-grade. This includes games, graphics apps, and multi-media apps.

    And, of course, there are the thousands of different Java games that are downloaded to mobile phones every day!

    So much for Java not being 'consumer-grade'!

  9. Re:let me get this straight ... by Decaff · · Score: 2, Informative

    Do you have any stats I could look at to support your statement? Just curious...

    yes, I do.

    I have been severely critical of Swing performance in the past, however it has improved dramatically.

    here is a single post which gives a typical comparison:

    http://www.javalobby.org/java/forums/m91832009.htm l

    But in the end, the best thing to do is to download NetBeans + Java 5.0 and Eclipse (the GTK version is best) and try them out.

  10. Re:let me get this straight ... by cortana · · Score: 2, Informative

    More people need to know about the Java-Gnome project!

  11. Re:let me get this straight ... by Rycross · · Score: 2, Informative

    Doing a quick google search it appears that C# often beats Java or shows comparable performance in most tests. That is unless you're a Java zealot who bases opinions on limited and unfair tests.

    In real-world applications, C# matches up quite well to Java's speed.

  12. Re:How cross-platform by kingos · · Score: 2, Informative
    I do c# development at work (largely for the windows.forms gui code, most server side is c++).

    I took a console application that used network sockets, timers, and was completely multithreaded that I had compiled using microsoft's c# compiler, and copied it to a linux server (no recompile).

    Fired up mono ... it worked flawlessly, first time. I was impressed.

  13. Re:let me get this straight ... by xiphoris · · Score: 2, Informative

    This is actually totally false. As well as being supported by a number of more "minor" languages, .NET fully supports: C#, C++ (with solid, awesome extensions for the .NET parts), VB, JS.NET.

    Keep in mind that there are always extensions so that you can call methods in native assemblies on your platform. This means you can pretty much interact with anything.

  14. Re:let me get this straight ... by CastrTroy · · Score: 3, Informative

    The only reason that most people find .Net or Delphi any easier for GUI work than Java is because there are very few good drag and drop environments for creating Swing and AWT GUIs. The best one I've seen so far is the one that Comes with NetBeans. It makes GUI development a lot easier. It's still not as good as what they have for .Net or Delphi, but it's workable. If you are stuck doing your UI coding by hand, or using the terrible Eclipse extension, then you might want to take a look at NetBeans.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  15. Re:Agreed... by syncomm · · Score: 2, Informative

    Mono will always be on the fringes of acceptance like WINE... Never quite compatible and necessitating that you keep returning to Windows at least semi-frequently for that last bit of missing compatability. How is this insightful?! These claims are flamebait and based on absolutely no evidence. The fact is .NET/C# is ANSI and public. It is not an "emulator", but rather an implimentation. There is no semi-frequently returning to Windows about it.

  16. Re:let me get this straight ... by slide-rule · · Score: 3, Informative

    While I'm prepared to leave delegates, properties, and multidimensioned arrays on the table, Java *does* [now, at least] have type-safe enum with a new 'enum' keyword, auto-boxing of primitives to their wrapper class, and a modified 'for' syntax that is functionally equivalent to 'foreach' (and yes it works with the new enum as well as any iterable collection). Surprised you didn't list generics/templates, which java now has implemented and backported into the full Collections API. Pretty neat stuff; have been playing with most of this it all week, now.

  17. Re:Not for me by cr@ckwhore · · Score: 2, Informative

    Actually, it's not "mimicking" anyting ... .NET is Microsoft's implementation of the Common Language Infrastructure, which is an ECMA (international) standard. Microsoft co-sponsored the submission of the CLI along with other companies, but it is by no means a proprietary "Microsoft thing".

    Mono happens to be a 'nix implementation of the CLI. Again, this is not "mimicking" anything... it's a native implementation of a recent standard. It also happens that the C# (also specified in the ECMA submission) implementation in Mono is basically complete.

    The problem right now doesn't sit with the c# language or Mono... the problem is that an appropriate cross-platform gui/widget set doesn't exist. GTK# shows some promise, but is slow to be adopted. Windows.Forms (Microsoft's GUI implementation for the CLI) *is* proprietary, and thus, has proved difficult to implement on platforms other than Windows. BUT, let's not confuse the implementation of Windows.Forms with the CLI/Mono because they really don't have much to do with each other.

    Additionally, Mono is NOT the only non-Microsoft implementation of the CLI. dotGNU Portable.net (www.dotgnu.org) is another -- and I'm sure there are more.

    Feel free to educate yourself on the CLI and it's background by starting here:

    http://www.dotnetexperts.com/ecma/
    http://www.ecma-international.org/publications/sta ndards/Ecma-335.htm

    --
    Skiers and Riders -- http://www.snowjournal.com
  18. Re:let me get this straight ... by miguel · · Score: 5, Informative

    I run the Mono project, so I can speak for our goals.

    And one of our goals is to be compatible with the .NET implementation. This is part of what we do on a day-to-day basis when we write unit tests for the APIs we are implementing, when we keep track of any possible difference and we respond to bugs filed on our bug tracking system where the behavior differs by fixing the differences.

    But our goal is not limited to *only* being compatible with Microsoft's .NET. We have also grown outside of the scope of what .NET has to offer, and this is why you see a very healthy ecosystem of libraries and applications *around* Mono which are not limited to being compatible.

    We created Gtk#, the toolkit we recommend for new applications that are to be cross platform; The enhanced XML stack (Commons.RelaxNG and Mono.Xml.Ext), our extended security and cryptography stack (Mono.Security), our extended Database support (Mono.Data and all of the providers for proprietary and open source databases), our IL manipulation library (Cecil) and everything that goes with these libraries.

    We try to make our libraries cross-platform, because the same code will reach more users and helps grow our community, but every once in a while we have to create OS-specific libraries. For example, the Mono.Posix library is not completely portable to Windows. The Cocoa# library only works on MacOS X, as it is designed to be just an interface to Cocoa.

    Miguel.

  19. Re:Apples and Oranges by compass46 · · Score: 2, Informative

    Mono has multiple licenses, depending on what part of the framework you are talking about.

    http://www.mono-project.com/FAQ:_Licensing

  20. Re:Much smoke, small fire by Anonymous Coward · · Score: 1, Informative

    How large is your GTK suite of libraries?
    How large is your QT suite of libraries?
    How large is the Java runtime?
    How large is X windows?

    20 megs for a comprehensive framework like Mono isn't large.

    (`apt-get instal emacs21` tells me that I need 42MBs of space!)

  21. Re:Why bother? by m50d · · Score: 2, Informative
    With Java you now have a complete implementation of all language APIs on Windows, Linux, Solaris, HP and so on,

    With a horrible license and horrible performance.

    not an incomplete port of .NET (Mono) potentially subject to Microsoft patents. Anti-mono people go on about the patent bogeyman even though MS has *never* used a patent aggressively, and there are situations where it would benefit them far more to do so (OOo, Samba). The threat of patents is just so much hot air.

    If the Apache Harmony projects succeeds (and it has a lot of backing) there will be a complete open source cross-platform Java implementation.

    Vaporware, gimme a break. People have been saying we will have a complete open source cross-platform Java implementation for as long as Java's been around. It's never materialised.

    There are already open-source Java versions that are good enough for many applications (gcj, Kaffe).

    Look who's an incomplete port now. gcj and Kaffe are good projects and I support them but if you try and run a random app on them it's not even "hmm, this might work, we can hope", it's "let's see where this breaks".

    Mono is a waste of time.

    Right now I have a working, open source implementation of all of .Net that I need, which installs easily on every platform I've seen in use. Or, I have a horribly-licensed and horrible-to-install (especially on BSD) Java implementation, or a number of attempts at an open source Java which though initially promising seem to be going nowhere and won't run the vast majority of java programs.

    --
    I am trolling
  22. Re:How cross-platform by m50d · · Score: 2, Informative
    But, will a Mono app/code base developed on Linux run just as smoothly on the .NET runtime in Windows?

    Yes, that's the whole point, though it only will if it sticks to the standard APIs. There are things which are only supported in Mono, but they are split off into their own namespaces (usually Mono.*). The same is true with Java, if your thing uses sun.* it won't work on non-sun jvms.

    --
    I am trolling
  23. Re:Where are the apps? by Decaff · · Score: 2, Informative

    Cut the crap. My computer has 512MB DDR RAM, and each time I use a Java application it starts swapping LOADS. The computer is nearly UNUSABLE due to all swap usage.

    Strangely, mobile devices can run java in just a few 100k. The Java 5.0 VM itself can run in just a few MB.

    Write a simple Java 'hello world' program, and you will find it can run in just a few megabytes (use the -Xmx switch to set the max usage).

    So the claim that your machine will swap 'each time you use a Java application' is provably nonsense.

    I'll start Eclipse, to tell you how much RAM the JVM will use (it might be a shock for you!).

    It's an IDE for goodness sake! They are some of the largest apps.

    Mind you, the NetBeans IDE can run quite happily in moderate memory. In fact, if you look at the IDE config file for NetBeans 4.1 you will see that the IDE is by default not allowed to use more than about 90-100MB.

    In fact, I have just started it giving it a maximum memory of 64MB.

    Try it yourself! I am using Java 1.5.0_04 and NetBeans 4.1. The configuration file within the netbeans install directory is etc/netbeans.conf.

    So, on a 512MB machine, it isn't causing swapping. (It never does on my PCs, which have this memory).

    Saying Java is performing nearly as fast or even faster than C++ is BULLSHIT.

    If it is, then it is bullshit backed by considerable evidence. Last year there was a study of java speed for numerical work, using the well-known Linpack benchmark:

    http://www.shudo.net/jit/perf/

    Java 5.0 usually came within 5-10% of optimised C++.

    So, I am sorry, but you are plainly factually wrong.

    If you don't believe me, again, try it yourself. The source code for these benchmarks is available.

    You may also be interested to know that Java is now so fast it can be used for real-time device control and AI systems. Boeing use Java for robotic and autonomous experimental planes, and one of the entrants for this years robotic road race has its software entirely in Java.

  24. Re:Where are the apps? - What Speed? by Decaff · · Score: 2, Informative

    But imagine if all your applications took a couple seconds to open. Even notepads or terminals or calculators or system monitors. It would change the way you used your computer.

    That is exactly the situation on all my workstations right now, and I have never seen a system that is faster. It changes nothing, of course.

    I have stated that I do not want to wait even a few seconds for an application to load. It's obnoxious to me and, I would venture, most other users. I don't understand why you are supporting the idea that latency is good.

    I am not. I am just saying that below a certain point it is completely irrelevant and has no impact on the user. I have been in IT for 25 years and have never seen anyone ever complain or have any issues with a 2 or 3 second load time. When you say that this is obnoxious to most users, I have good evidence from decades of IT support that you are just plain wrong.

    If this really is annoying to you, you must find the majority of applications on any workstation intolerable! I use both GNOME and KDE routinely and I can't think of a single application that starts up in less that 2 seconds.

    Small, orthogonal tools. That's the UNIX philosophy, right?

    Sure. I agree. But that has never ever applied to GUI systems; they have always had some lag.

    Also, please note that the bulk of Microsoft Word's libraries are NOT preloaded with the operating system.

    Fair enough, but you mentioned Notepad. I would be very interested to see a 2 second startup for any Office application anywhere - Microsoft or otherwise!

    Your statement's only grain of truth is that IE's rendering libraries are indeed preloaded (they are used within the Explorer shell).

    Wrong. The text editing controls are preloaded (hence Notepad's speed), the menu and GUI controls are loaded, the file browsing tools are preloaded. (This is the advantage of a common GUI library in Windows).

    Because of Java's failings, I dislike Java -> anything. Does this make sense?

    No. Because as far as I can tell, what you are labelling as failings simply would not even be noticed by the majority of users, so I don't believe it is fair or sensible to call them failings.

    Yet again, I would be interested in proof that a start-up time of a GUI app of a few seconds has any ergonomic impact on anyone anywhere, other than being annoying to you.

    You are imposing a requirement on GUI software that almost no major GUI application meets. If such applications, written in supposedly high performance languages like Delphi, C and C++ can't do this, why should Java be any better?