Undefined CLR namespace

前端 未结 10 1137
萌比男神i
萌比男神i 2020-12-18 23:18

I have the following:

\"Error!

The error says The \'clr-namespace\' URI refers to a na

相关标签:
10条回答
  • 2020-12-18 23:27

    Also verify the "BuildAction" of the .xaml files (see file properties). Should be "Page". After I moved files and renamed the namespace this setting changed somehow to "CodeAnalysisDictionary". This also leeds to this error.

    0 讨论(0)
  • 2020-12-18 23:28

    I've had the same issue, mine was self inflicted due to copying and pasting code from another source into my project and renaming objects as I went without building first.

    So, this means Visual Studio or the compiler do not pick up on incorrect references (eg, in my code I had this:

    MyObect mo = new MyObect();
    

    When I copied the code over, I corrected the spelling of MyObect to MyObject but, Visual Studio has still referencing MyObect and didn't give any warnings about this. And this was code was part of a .XAML file and as such, I was not only getting the error message you were, but also .g.cs errors too. All of them pointing to the incorrect reasons.

    This was also occuring in the ResourceDictionary (within my datatemplate declarations for all my VM binding)

    0 讨论(0)
  • 2020-12-18 23:34

    Well, as far as I can see, that namespace simply doesn't exist ;-) In your ViewModel folder is no file. And without file, there is no namespace. Namespaces are not defined by folder structure but inside source files.

    0 讨论(0)
  • 2020-12-18 23:34

    I got this after Windows 7 computer crash when I was in solution in Visual Studio 2008. It seems to have blanked out the start-up configuration. I reset this and then it could find the name-space. This is one cause - probably not the major one - but just in case you have same.

    0 讨论(0)
  • 2020-12-18 23:36

    I had the same problem and solved it by not having my project in a path with hash-mark.

    E.g D:#Temp had to be D:\Temp

    I guess there's someone at Microsoft having missed an EscapedCodeBase in conjunction with the URI.

    0 讨论(0)
  • 2020-12-18 23:45

    Assuming your ViewModel folder isn't empty (or there actually is a type with BlooblieBlablie.ViewModel as its namespace), and BlooblieBlablie is the assembly name, the following should work:

    xmlns:vm="clr-namespace:BlooblieBlablie.ViewModel;assembly=BlooblieBlablie"
    
    0 讨论(0)
提交回复
热议问题