如何使用 WPF 表单构建库 [英] How to build library with WPF forms
问题描述
是否可以构建一个类库 dll,其中还包含 WPF 表单?当我尝试构建一个时,我收到以下错误:
Is it possible to build a Class Library dll which also includes WPF forms? When I try to build one I get following errors:
错误 1 库项目文件无法指定 ApplicationDefinition
元素.
错误 2 项目文件包含无效的属性值.
Error 1 Library project file cannot specify
ApplicationDefinition
element.
Error 2 The project file contains a property value that is not valid.
如果我将我的项目设置为 Windows 应用程序,它会编译 &运行寿.有没有办法解决这个问题?我正在使用 VS2010 &如果你们对 C# .NET 4.0 感兴趣的话.
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.
谢谢
推荐答案
在创建/向解决方案添加新项目时选择 WPF 自定义控件库
或 WPF 用户控件库
.
Choose WPF Custom Control Library
or WPF User Control Library
when creating/adding new project to your solution.
这篇关于如何使用 WPF 表单构建库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!