The tag 'XXX' does not exist in XML namespace 'clr-namespace:YYY'

前端 未结 10 994
渐次进展
渐次进展 2021-02-07 11:59

I have implemented a converter to convert Int32 to String to be able to binding a property to a textBox.

I implement this converter in the namespace MyApp.Converters and

相关标签:
10条回答
  • 2021-02-07 12:08

    Three fixes to make here:

    1. No spaces -> xmlns:converter="clr-namesapce:MyApp.Converters,aseembly=MyApp"
    2. No misspellings -> xmlns:converter="clr-namespace:MyApp.Converters,assembly=MyApp"
    3. Right delimiters -> xmlns:converter="clr-namespace:MyApp.Converters;assembly=MyApp"

    From the the documentation:

    Note that the character separating the clr-namespace token from its value is a colon (:) whereas the character separating the assembly token from its value is an equals sign (=). The character to use between these two tokens is a semicolon. Also, do not include any whitespace anywhere in the declaration.

    0 讨论(0)
  • 2021-02-07 12:09

    I am exploring as to why this is happening, but if your converter is in the main assembly, removing the assembly= from your xmlns:converters tag should remove that build error.

    0 讨论(0)
  • 2021-02-07 12:09

    For the record ... I've face a similar problem and if I removed the ";assembly=X" part from the XAML it worked fine

    But don't really understand the reason.

    As suggested in this blog: http://zoomicon.wordpress.com/2012/07/02/fix-the-tag-xxx-does-not-exist-in-xml-namespace-clr-namespaceyyy/#comment-7761

    0 讨论(0)
  • 2021-02-07 12:09

    use the assemble tag only if it is in another project. other wise use just namespace tag alone. For me this fixed the issue

    0 讨论(0)
  • 2021-02-07 12:09

    There is one very obscure case when you get this error - if you're using Microsoft.mshtml.dll and you upgrade to Windows 10 anniversary edition, or as it turns out the Creator edition too.

    Even if this isn't what happens to you make sure the library containing the component that cannot be found can be fully compiled. Look in the error list (not the grid but the Output console) for any clues.

    In my case I was using Microsoft.mshtml.dll as part of an HTML editor and it was unregistered somehow (in the GAC).

    The following article explains with screenshots:

    https://techninotes.blogspot.com/2016/08/fixing-cannot-find-wrapper-assembly-for.html#comment-form

    In short I had to run a Visual Studio command prompt (as admin) run these commands:

    cd C:\Windows\assembly\GAC\Microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a
    regasm Microsoft.mshtml.dll
    

    I did say obscure :-) The important point is to read the errors that may be buried amongst all your warnings because there might be an important clue.

    This can be especially confusing if an Operating system update suddenly breaks your project.

    0 讨论(0)
  • 2021-02-07 12:12

    All answers are right. And after trying all of them and you cannot configure why its happening, everything seems alright, Please restart the Visual studio.

    That worked for me after wasting almost 1 hour. I found everything ok, but restarted the VS with administration.

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