Upgrading a WinForms app to WPF Upgrading a WinForms app to WPF wpf wpf

Upgrading a WinForms app to WPF


I don't know for certain what in the project file informs Visual Studio what type of project is being used, but my guess is the "ProjectTypeGuids" is key.

My WPF projects have this:

<ProjectTypeGuids>   {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};   {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Here is a link I found which describes the guids and what kind of project they represent. You'll notice that the guid starting with "60DC" matches the list in the link for WPF applications.


Sailing Judo's answer worked for me to convert a WinForms project into a WPF, but did not describe in detail what is needed;

  1. Open the csproj file for the project you want to convert.
  2. Search for the string <ProjectTypeGuids> - most likly it will not exist.
  3. Add the following within the tag of the project file. If you have multiple PropertyGroup tags, use the one without a Condition attribute (e.g. the default properties).

    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

  4. Save - if you have the project open VS will ask to reload the project.

From what I see and test, I can now easily add WPF Windows and WinForms. My older WinForms also work without problems.


Sadly no.

WPF and Windows Forms projects aren't very compatible.

  • Try to extract as much fussinesslogic code into a class library
  • Create a new blank solution
  • Add a new WPF project to the solution
  • Add the class library project to thesolution
  • Set the class library as a dependency ofthe WPF project
  • Recreate the windows in WPF

Hope this works for you.

Best of luck with this endeavor!