7

I converted a Winforms project by hand-editing the proj file. Changed project type guids and added an application definition section, and now I can add WPF Windows, Pages, etc. to the project. One thing that doesn't work is, the files I added do not have autogenerated cs files, and every new window component are missing their InitializeComponent method.

Any ideas?

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
  • Is there a special reason you're doing it by hand? – Kenan E. K. Aug 01 '09 at 13:28
  • Yes, instead of creating a new project and moving all the files and dll and COM references to the new one, I am trying to achieve an in-place conversion. –  Aug 01 '09 at 13:31
  • 3
    Don't bother to do what you're doing. Make a new project file. – Dave Markle Aug 01 '09 at 14:03
  • You read my previous comment? This is my preference because of the project size and other management requirements. –  Aug 01 '09 at 14:26
  • possible duplicate of [Is there a converter from WinForms to WPF?](http://stackoverflow.com/questions/3188186/is-there-a-converter-from-winforms-to-wpf) – Dour High Arch Aug 08 '11 at 18:55
  • Does this answer your question? [Upgrading a WinForms app to WPF](https://stackoverflow.com/questions/450377/upgrading-a-winforms-app-to-wpf) – StayOnTarget May 18 '23 at 18:45

1 Answers1

7

If you unload the project you can edit the project file by adding/replacing the following element in the first <PropertyGroup> element:

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

This will change the project type to a WPF project.

carpenter
  • 1,192
  • 1
  • 14
  • 25