在WPF类库程序集(.dll)中是否可能有资源字典?我问这是因为我有一个应用程序WPF程序集(.exe),如果尝试将程序集的类型转换为 WPF类库,则会收到错误消息:
Is it possible to have a resource dictionary in a WPF class library assembly (.dll)? I ask this because I have an "Application WPF" assembly (.exe), if I try to turn the type of the assembly to "WPF Class Library" I get the error:
无法在库的项目文件中指定元素ApplicationDefinition
Impossible to specify the element ApplicationDefinition in the project file of the Library
我如何制作
推荐答案您会收到该错误,因为您的 XAML文件之一的生成操作设置为 ApplicationDefinition 。通常是 App.xaml 。删除该文件或将其构建操作从属性窗口更改为页面停止收到该错误。
You get that error because one of your XAML files has a Build Action set to ApplicationDefinition. Usually, that is App.xaml. Remove that file or change it's Build Action from Properties Window to Page to stop getting that error.
更多推荐
WPF类库与资源字典
发布评论