My project is moving to WPF! Yay! To minimize the pain I had a critical part of the UI migrated to WPF already using ElementHost from the System.Windows.Forms.Integration namespace. That went pretty smooth and now the rest is going through. Since I have not done a complete WPF project before I created a new WPF project and to my surprise there isn’t a Program.cs file in the project. I copy the App.xaml, Windows1.xaml and their .cs counterparts over to my winform project and tries to compile. The compiler spits the dummy as the project now has two main entry points. The WPF app.xaml implements Application, which if you look under it has Run(), which is what I use to start my winform main window in my original main method. I then comment out the main method thinking it would start from app.xaml instead. It turns out that you need to add couple of lines to your .csproj file like:
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
Change “App.xaml” to what you are using and voila!