Mono and SharePoint

One of my friends today asked me why he couldn’t run SharePoint on Linux because in a variety of times when I blog or write, I allude to the fact that SharePoint is basically an ASP.NET 2.0 application, which should be provided by Mono. While this is the case, I can think of several reasons why SharePoint in its current state just won’t work. I think the most compelling is the amount of Platform Invokes (PInvokes) that SharePoint calls. For the administrators reading this, a Platform Invoke is when you are from managed code calling the native Win32 API functions. One of the easiest ways to demonstrate an example invoke is using the little beep function that you can make the computer do a chirp with, which just takes two simple integers as parameters to control the beeping:


public static extern bool Beep(int frequency, int duration);

[/csharp]So, what are some examples of some of the platform invokes that it makes? From the Microsoft.SharePoint namespace we can see that following being called:


So, let’s take a quick example, so that I feel like I did a good explanation of this. The assembly in that list that is most attractive to me is the crypt32.dll (Crypto API32), which most notably is responsible for encryption, decryption, and certificate manipulation. So, why is it called from Microsoft.SharePoint? Well, it is used by Microsoft.SharePoint.Utilities.CertificateManager, specifically the CreateSelfSignedSslCertificate method (which a lot of people have told me can cause invalid handle errors within the Shared Services provider related to search, which if you do run into can be solved by just giving the appropriate access to the C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys folder), which from my little understanding of it does what the method name implies, creates a X509 compliant self-signed certificate.

There are a variety of other minor reasons I don’t think it will fly, such as missing methods in the Mono framework and ones that just aren’t implemented, however if someone can get SharePoint to run on Linux (while staying legal), sign me up!