DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. A cross-platform story – Visual Studio solution in MonoDevelop

A cross-platform story – Visual Studio solution in MonoDevelop

Denzel D. user avatar by
Denzel D.
·
Jul. 03, 10 · Interview
Like (0)
Save
Tweet
Share
13.01K Views

Join the DZone community and get the full member experience.

Join For Free

I was really curious about doing a little bit of experimenting – working on Visual Studio projects with Mono. What was my idea is the ability to collaborate on the same solution with developers working on completely different platforms with different tools.

I created a WinForms application in Visual Studio 2010. I specified that it is a .NET 3.5 solution (working with the default .NET 4.0 won’t make any sense since it is not supported – it will only open the solution but nothing from that point), but since it is using WinForms 3.5 controls, I was thinking that Mono will probably try to block some things due to an unsupported control version (WinForms 2.0 is listed as the only supported version). The project I created was quite simple – a single form with a couple of standard controls and some LINQ to read a XML file that was bundled with the project. The UI looked like this:

Pretty basic, isn’t it? I didn’t focus much on putting various controls on the form since I was just trying whether Mono will correctly recognize and work the layout and the code behind it. The LINQ code that I was using looked like this:

XDocument doc = XDocument.Load(Application.StartupPath + "\\sample.xml");

IEnumerable<XElement> x = from c in doc.Elements().Descendants() where c.Attribute("id").Value == "1" select c;

foreach (XElement element in x)
MessageBox.Show(element.Value);

With the solution ready, I fired up the virtual machine, loaded Ubuntu and started MonoDevelop. When I navigated to the shared folder, where I copied the Visual Studio solution, MonoDevelop recognized its main file as a known file format (if you take a look at the icon):

So far this was a good sign – this means there is at least something to work with. Once I opened it, there were no error messages or anything – the only problem was with the System.Deployment reference that wasn’t available in Mono (Mono doesn’t support ClickOnce), but that is a known fact so I was well aware that it won’t work.

Now to the most interesting part – the main work form. First of all I must say that there is no visual designer for WinForms applications. For GTK# applications created in MonoDevelop, there will be a somewhat similar toolset as the one for WinForms and a visual designer (although it requires some time to get used to it since its principles are a bit different compared to the Visual Studio WinForms designer), but nothing for WinForms by itself, so in case you are going to work with WinForms applications in MonoDevelop, make sure you know how to work with element layout editing via code.

When I built the project, there were absolutely no errors (but a warning regarding a missing referenced assembly). Now it was time to actually run the project. And it worked!

The layout looked really messy and resembling a Windows 95-ish UI style, but it was loaded. Besides, the control placement was a bit different compared to the one you can see for the same form in Windows.

The LINQ query executed fine and I was able to see the message. Surprisingly, it recognized WinForms controls versioned 3.5. Although I understand that 3.5 controls mostly aren’t much different from 2.0, this was a pleasant surprise.

As a conclusion, I’d like to mention that it is possible to collaborate on .NET projects the way I showed in this article, but after all it will require a bit more work to set the project correctly on Mono (especially due to lack of some tools). Being able to develop cross-platform apps is worth it, though.

In case you want to check whether a project will work on Mono (imported from .NET), I’d highly recommend using MoMA (Mono Migration Analyzer) that can be downloaded here.

Cross platform MonoDevelop

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Monolithic First
  • Building Microservice in Golang
  • Introduction to Container Orchestration
  • NoSQL vs SQL: What, Where, and How

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: