Error: 'Cannot create unknown type '{clr-namespace:NameSpace.Properties}Settings'.'

前端 未结 4 1564
南笙
南笙 2020-12-09 02:08

I define my settings and styles in a ResourceDictionary:



        
相关标签:
4条回答
  • 2020-12-09 02:12

    Keep your "Build Action" property to "Resource" and just change this row:

    xmlns:properties="clr-namespace:Kavand.UI.Properties"
    

    with this:

    xmlns:properties="clr-namespace:Kavand.UI.Properties;assembly=Kavand.UI"
    
    0 讨论(0)
  • 2020-12-09 02:29

    I had set the file's "Build Action" property to "Resource". When I changed it to "Page" the problem was resolved.

    0 讨论(0)
  • 2020-12-09 02:29

    As a variation on other answers & comments, this worked for me:

    • Set the file's "Build Action" property to "Page".

    • Build (problem gone - but...:)

    • Set the file's "Build Action" property to "Resource".

    • Build

    • Problem still gone!

    Seems like a VS bug to me.

    0 讨论(0)
  • 2020-12-09 02:32

    Just posting another potential solution, because i just recently stumbled over this exception.

    It could be that your referenced class-cefinition (in your case "Kavand.UI.Properties.Settings") does not use "public"-access-modifier.

    So in my case i could solve this problem by writing public before the class definition.

    0 讨论(0)
提交回复
热议问题