Visual Studio for Mac was recently released. In a previous post I compared how much easier it is to make native Mac apps with Xojo than with Visual Studio for Mac. Now I’d like to talk about making cross-platform desktop apps.
Visual Studio for Mac lets you make cross-platform desktop apps by using the Gtk# UI toolkit. Unfortunately, Gtk# does not create native apps for any platform and you’ll be required to manually install the required .NET run-time library in order for these apps to work. Packaging these types of apps can be a pain and is not done automatically by Visual Studio for Mac.
Although Visual Studio for Mac doesn’t include a layout editor when creating native Mac apps, it does include a Layout Editor for your Gtk# layouts. Here you can see the control layout for a simple “Hello” app with just a button and a label:
The Layout Editor is a bit tricky to work with as dragging controls around does not show you exactly where they will be positioned, making it hard to line things up.
For comparison, this is what the Layout Editor looks like in Xojo:
To add code to the button in Visual Studio for Mac you have to click on the Signals tab in the Properties and add a handler to the Clicked signal. Once you do this, you can switch back to the source code file to add the code. Here you can see the source for MainWindow.cs and the “Clicked” handler that updates the number of clicks and displays the count in the label:
￼The above process for adding an event is not too bad, but Xojo makes it even easier by letting you add event handlers to a control by simply double-clicking on the control itself. For example, double-click the button to show the Event Handler window where you can add the Action event handler to the button by simply selecting it from a list:
And then entering the code in the Code Editor:
So you can see some similarity between working with Visual Studio for Mac with a Gtk# project and a Xojo desktop project. Obviously you can tell that Xojo uses a programming language that looks similar to VB, but the object-oriented programming model used by Xojo is similar to the one used by C#.
The big difference, as mentioned earlier, is that Visual Studio for Mac does not build native apps. Instead when you build the project shown above you’ll get an app called “HelloMac.exe” which doesn’t run on any platform without first installing the proper run-time libraries, not always an easy task. And a file with the extension of “exe” certainly does not look like a native Mac or Linux app so you’ll want to package that up to look more native (even if it won’t be native) so that your users are not confused.
With Xojo you don’t have to worry about any of that. Instead you can just check a few boxes to get native apps for each OS you want. When you Build your project you’ll get a separate folder containing a native app for each OS platform (Windows, MacOS, Linux, Raspberry Pi). Simply transfer the app to the OS and run it without having to worry about installing additional run-time libraries or even packaging. This is about as easy as it gets.
If you need cross-platform desktop apps and are looking at Visual Studio for Mac, you should definitely also consider Xojo. Xojo brings most of the same features to the table, but in a way that is much easier to use and dramatically easier to deploy.
If you haven’t yet, Download Xojo.