Upgrade to .Net 4.0

Fix #654