How to build library with WPF forms

Jens picture Jens · Dec 14, 2010 · Viewed 30.8k times · Source

Is it possible to build a Class Library dll which also includes WPF forms? When I try to build one I get following errors:

Error 1 Library project file cannot specify ApplicationDefinition element.
Error 2 The project file contains a property value that is not valid.

If I set my project as Windows Application it compiles & runs tho. Is there a way to get arround this? I'm using VS2010 & C# .NET 4.0 if that might be of any interest to you guys.

Thanks

Answer

decyclone picture decyclone · Dec 14, 2010

Choose WPF Custom Control Library or WPF User Control Library when creating/adding new project to your solution.