How to build library with WPF forms

后端 未结 6 1979
温柔的废话
温柔的废话 2021-02-05 00:53

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 Librar

相关标签:
6条回答
  • 2021-02-05 01:20

    Change the build action of your UserControl from ApplicationDefinition to Page.

    0 讨论(0)
  • 2021-02-05 01:22

    This is also occur when we copy paste an Image to ClassLibrary Project.

    Change the Build Action Property of that image to resources

    0 讨论(0)
  • 2021-02-05 01:34

    Extending @2493490 answer.

    Right click on the app.xaml file and exclude it from the project. Change the project output type to in project properties to Class Library. Click on the run icon, the solution will successfully build but will not run/execute any code. A error message will be displayed explaining as such.

    0 讨论(0)
  • 2021-02-05 01:39

    Remove the App.xaml and App.xaml.cs in your WPF Project. Then you will be able to run the project with an output type of Class Library.

    0 讨论(0)
  • 2021-02-05 01:40

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

    0 讨论(0)
  • 2021-02-05 01:42

    problems after copying XAML controls from WPF Application to class library

    The first answer work for me. I changed App.xaml from ApplicationDefinition to Page and worked

    0 讨论(0)
提交回复
热议问题