When working in C# projects that target multi plataforms and need to have a high code reuse ration, like those that must run on iOS, Android, Windows Phone and any other desktop platform where .NET might run (Windows itself, Linux and Mac) it is common to face a problem: how to share code between the different projects, while maintaining your sanity?
PCL (Portable Class Libraries) is a possible solution, however it is a fairly new feature even in Visual Studio (it is fully supported starting in the 2012 version), and Xamarin Studio / MonoDevelop still have some heavy work to do. Also, PCL imposes some restrictions on what you are allowed to do as well.
One common approach is to have a “Core” project that targets the full .NET framework, and a series of “Linked” projects with compiler flags specific to each platform. This is very well described at the page “Sharing Code Options” at Xamarin’s website. However, do that by hand is not productive and error prone. Visual Studio users can make use of a extension, but how about Xamarin Studio?
Wait no more, now it is possible to do project linking in Xamarin Studio / MonoDevelop as well, with the Project Linker extension I created.
This addin was developed in order to automatically create and maintain links from a source project to a set of target projects, in order to make code sharing between different plataforms a more friendly task. It is based on the Visual Studio Project Linker extension.
The main reason behind the development of this addin was that I was working on a project that targets multiple plataforms using the great MvvmCross library, including iOS, Android, Windows, Mac and Linux, and PCL support was very lacky on Xamarin Studio, and even on Visual Studio 2012 it had its problems. Also, PCL programming imposes some restrictions that I found harder to workaround than using a third party plugin to do the file linking between the projects.
Features
- Automatically replicates “new”, “delete” and “rename” operations from the source to the target projects
- Allows to perform a manual synchronization, which is useful if you use both Visual Studio and Xamarin Studio or if someone else does not have the plugin and changes the project
