Reading Excel sheets using F# without COM

I needed to create an utility that would read Excel 2010 files (.xlsx) and generate XML files from them according to some specific rules. The catch was that the utility needed to run on MacOS instead of Windows.

Reading and writing Excel files from .NET is very easy using the Microsoft.Office.Interop assemblies but they use Excel through COM and that makes them unusable outside of Windows. I found some 3rd party libraries for working with Excel and analzyed them with The Mono Migration Analzyer (MoMA). MoMA is a handy tool that analyzes .NET assemblies and tells you if they will run on Mono. Many of the Excel libraries I found were unusable for my use-case because they were using PInvoke calls. Only the ExcelPackage library runs on Mono.

I wanted to use the ExcelPackage from F# not C# so I wrote a very simple F# wrapper, that you can freely use. For now it contains just a few methods

[Read More]
excel  fsharp  mono 

Using .NET libraries with MonoTouch

I have been playing with MonoTouch only for a few days when I already started to miss all the .NET libraries I commonly use. The first one I needed to get working with MonoTouch was JSON.NET.

MonoDevelop does not support Nuget so you have to get your libaries the old way. I downloaded JSON.NET package from Nuget.org, but it does not contain a DLL built for Mono. Harldy any Nuget package does. You can reference a DLL built for .NET, MonoDevelop will recognize it and even offer you IntelliSense but your project will not get built.

The right way to get a .NET library working with MonoTouch is downloading its source code and building it yourself. You can use MonoDevelop to build the source codes. The only think you have to do (at least for JSON.NET) is to change the .NET profile to an equivalent Mono profile in the project settings.

[Read More]

MonoTouch: iOS development for .NET programmers

Beeing quite disappointed with the Windows Phone platform recently I started to look for other ways to use my .NET skills and to develop for a mobile platform at the same time. I found MonoTouch, a product from Xamarin that allows you to build iOS apps using C# with Mono.

What is MonoTouch?

MonoTouch is a product or a framework do develop iOS apps using Mono (an open-source .NET implementation). It allows you to use C# (hopefuly also F# although I have not been able to get it to work yet) and all the .NET features libraries you use and like and of course your existing codebase. No Objective-C knowledge is required, but you will have to learn about the iOS ecosystem an iOS SDK. The iOS SDK is also needed, so you cannot do the development in Windows, you have to use a Mac. There are ways to get MacOS X working on a PC as a native install or in VMWare / VirtualBox, if you just want to try it out, but it may not be legal.

[Read More]
csharp  ios  mono