You may have noticed that in .NET 4, there is actually no apparent “Main” method in your code. This is because it is now designer generated for you. So Step 1 is to remove some of this auto-generation by editing the build action of your App.xaml file from “Application Definition” to “Page”.