Added define NET40 to enable compilation for .NET 4.0