No creation of a WPF window in a DLL project?

前端 未结 4 1903
梦毁少年i
梦毁少年i 2020-12-02 16:56

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

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 17:10

    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 element under Project/PropertyGroup contain the following GUIDs

    {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

    Also, make sure you reference PresentationFramework and System.Xaml in your project, or you will not get any WPF in your code.

提交回复
热议问题