<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 窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-29 15:57
查看更多