Search code examples
wpfprism

Change the project type from class library to WPF User control library


While setting up my Prism WPF solution I had added a project as Class library. Just realized I want it as a WPF user control library to add resource dictionaries and other WPF related stuff. Is there a way to convert my class library project to WPF user control library project? (Project properties just has the option to convert between Console, Class library, Windows app!)


Solution

  • it is not an easy change through the project properties (alt+enter). you need to manually edit the .proj file in an editor ( say notepad / textpad) when you compare a classlibrary project and a WPF Usercontrol library projects .proj file you will find the difference in them is through the nodes in the node.

    you need to add ProjectTypeGuids , WarningLevel and TargetFrameworkProfile . it is my understanding, they started to dictate a project type through the PRojectTypeGuids node! which is really cool!

    create a class library project and a WPF usercontrol library project and open the .proj files in an editor to compare, you should be able to figure out what i am talking here!