Building with Visual C# Express Edition

Dec 14, 2011 at 11:31 PM

This took me a while to figure out so I wanted to share.

Guia uses System.Diagnostics.Contracts from Microsoft Research that does not work with VS2010 Express Edition. If you are using an Express Edition you'll have to implement it yourself. Turns out it is easy! I just added this code to my project to get guia.codeplex.com to compile (you might need to add additional Require prototypes):

using System;

namespace System.Diagnostics.Contracts
{
    public class Contract
    {
        //Note: can't use __arglist in template function
        static public void Requires<T>(bool b, string s = "") { Requires(b, s);  }
        static public void Requires(bool b, string s = "") 
        {
            if (!b) throw new Exception("Contract.Requires " + s);
        }
    }
}