Changed project target framework to .NET 4.0 and fixed the few 4.5-specific calls.