Forum General

[open source] Protobuild: A cross-platform project generator for C# and C++

JuneRhodesJuneRhodes AUMember
edited July 2015 in General

Oh hi everyone,

I figured I'd announce this here to see if anyone is interested in using it. Over the past few years I've been working on an open source tool called Protobuild, which is a project generation system for cross-platform projects. The most well known user of Protobuild is perhaps the MonoGame team, who use it to manage building MonoGame for all the platforms they support.

If you're finding yourself in a position where your solution has a project for each different platform, like MyProject.Windows, MyProject.iOS, MyProject.Android, etc, then Protobuild can be used to unify these into a single project definition, which then gets generated and synchronised by Protobuild.

Protobuild supports generating platforms for iOS, Android, Windows, Linux, Mac, Windows 8.1, Ouya, Windows Phone 7, Windows Phone 8.1 and the Web platform via JSIL. It also supports PlayStation Mobile, although Sony recently deprecated this platform so it's likely to be removed in a future release.

Basically when you're using Protobuild, your projects are defined in XML files that look something like this:

<?xml version="1.0" encoding="utf-8"?>
<Project Name="MyApp" Path="MyApp" Type="App">
  <Properties />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="MyExternalProject" />
    <Compile Include="MyClass.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="MyClass.Windows.cs">
    <Compile Include="MyClass.Linux.cs">
    <!-- ... -->

What separates Protobuild definitions from normal C# projects is that the platform-dependent structure (such as project type GUIDs) is all handled by the project generator when you run it. You can also define references that are conditional on platforms, by defining an external project and referencing it:

<?xml version="1.0" encoding="utf-8" ?>
<ExternalProject Name="MyExternalProject">
  <Platform Type="Windows">
    <Reference Include="SharpDX" />

  <Platform Type="Linux">
    <Reference Include="OpenTK" />

There are also some other features of Protobuild:

  • The projects that Protobuild generates can be opened in any IDE; Visual Studio, Xamarin Studio and MonoDevelop all work.
  • Protobuild supports synchronisation; when you make changes in your IDE such as adding or removing files, when you run Protobuild again those changes are synchronised back into the definition files. This means you don't need to hand edit the project definition files for simple tasks.
  • It supports cross-platform C++ projects, and most importantly, it can automatically wire up the SWIG binding generator so that referencing a C++ project from a C# project is as simple as adding to your project. This works on cross-platform as well.
  • It has a package management system that truly supports cross-platform libraries, including those that need to P/Invoke at runtime and those that want to produce different code for different plaforms. (For a comparison to NuGet, see this link and this link).
  • Protobuild's package management system has packages in both source and binary format. If you need to debug a third party library, you just need to run "Protobuild.exe --swap-to-source" and Protobuild will handle the rest. The library then appears with full source code in your IDE where you can then debug, add breakpoints, etc.

If you think Protobuild might be useful for you, or if you have any questions feel free to reply to this thread and I'll answer them. You can also get started with Protobuild straight away by following the Getting Started guide.


  • DevsterDevster GBMember
    1. Is the output supported by Visual Studio 2015?
    2. Can it generate portable code projects as well?
    3. Does it support portable library references?

    Thank you.

  • DevsterDevster GBMember

    PS: does it have any support for F#?

  • JuneRhodesJuneRhodes AUMember

    Is the output supported by Visual Studio 2015?

    As far as I know, yes. I've opened projects generated by Protobuild in the 2015 RC before and everything has worked fine.

    Can it generate portable code projects as well?

    You can generate PCL projects for a NuGet bait-and-switch. I don't recommend using PCLs for concrete code implementations as they aren't well supported on platforms like Linux (but you can force an assembly to be a PCL with the ForcePCL property).

    Does it support portable library references?

    You can reference any C# project you like via the ExternalProject declaration; see for more information on external projects.

    PS: does it have any support for F#?

    Not yet, but if people are interested in that I can add support for that (it'll be far easier than the C++ support was).

  • DevsterDevster GBMember
    edited July 2015

    Sounds useful for super-multi-platform projects with lots of code where contributors work on different platforms using different IDEs. MonoGame is a perfect example of such a codebase. I hope we will see more of similarly large client-side projects in future with the .NET ecosystem growing and Protobuild could help. Maybe cross-platform WPF whenever it gets open-sourced :). I kind of manage linked files manually at the moment, but now Protobuild will be at the back of my mind. Thanks.

    PS: maybe suggest it to ? They support many platforms.

Sign In or Register to comment.