在DLL项目中没有创建WPF窗口? [英] No creation of a WPF window in a DLL project?
问题描述
是否有一个原因,Visual Studio不会让我在一个DLL项目中创建一个WPF窗口?应用程序项目并将其复制到我的DLL项目。
我还发现我可以创建一个UserControl并将基类更改为Window。
但是,如果我这样做,可能是因为我不应该这样做...
确保项目类型是 WPF用户控制库
当您创建项目。
如果不是没有汗水,只需编辑csproj文件,并确保< ProjectTypeGuids>
元素项目/ PropertyGroup
包含以下GUID
< ProjectTypeGuids> {60dc8134-eba5-43b8-bcc9-bb4bc16c2548}; {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}< / ProjectTypeGuids>
此外,请确保您在项目中引用PresentationFramework和System.Xaml,否则您将无法在代码中获取任何WPF。
Is there a reason why Visual Studio won't let me create a WPF window in a DLL project?
I "solved" it by creating a window in an Application Project and copying it to my DLL project. I also found that I could just create a UserControl and change the base class to "Window".
But if I had to do it this way, it's maybe because I shouldn't do it...
Make sure the project type is WPF User Control Library
when you create your project.
If it isn't then no sweat, just edit the csproj file and make sure the <ProjectTypeGuids>
element under Project/PropertyGroup
contain the following GUIDs
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Also, make sure you reference PresentationFramework and System.Xaml in your project, or you will not get any WPF in your code.
这篇关于在DLL项目中没有创建WPF窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!