the name <…> does not exist in the namespace clr-namespace <…>

前端 未结 25 1018
名媛妹妹
名媛妹妹 2020-11-28 04:59

I have a small WPF application which used to compile just fine but is not anymore. I can\'t really say at which point it stopped building. It just worked fine one day, and t

相关标签:
25条回答
  • 2020-11-28 05:34

    I was facing the same issue. You get this error but still you can build your project successfully, The inconvenience is that you can not see the UI designing (or just want to clean the code & remove annoying wiggly lines). Read many posts are tried several things but following works like a charm.

    Tried this in Visual Studio 2019:

    Right click on your Solution -> Properties -> Configuration Properties, then change the project configurations from Debug to Release or vice versa.

    After that, rebuild your solution. It can solve your problem.

    0 讨论(0)
  • 2020-11-28 05:35

    There is a glitch with their buffering of the objects layouts. If anything gets renamed or moved, it gets lost. What generally works for me is to create a completely new class and copy in all the old code, get it working on the new class, then remove the original class. Sometimes after you get it up and running with the new class name, you can try renaming it back to the original name (but usually not)

    0 讨论(0)
  • 2020-11-28 05:39

    Had this problem going round in circles wasting a few hours. I moved a separate user control dll into the project so it was compiled in the project and not a dll referenced. This broke the whole project so I then went through checking meticulously all namespaces, paths and file names. Tried deleting obj files, changing between release and debug, between x86 and AnyCPU. Opening saving all, recompile still no joy.

    Remember having a similar problem before previously, the error flagged in VS2013 was not directly related to where I had to modify the XAML but by using

    x:Name="myControl"
    

    on all controls, instead of

    Name="myControl"
    

    fixed it.

    0 讨论(0)
  • 2020-11-28 05:41

    I was using xmlns:local="using:MyRootNamespace.ChildNamespace" at the header of the .xaml , and i turned it into xmlns:local="clr-namespace:MyRootNamespace.ChildNamespace" ... well, I just let intellisense do the job, and it worked.

    0 讨论(0)
  • 2020-11-28 05:42

    This is what worked for me on Visual Studio 2012 (Update 3).

    • Restart Visual Studio
    • Add current assembly to namespace declaration xmlns:framework="clr-namespace:TimeRecorder.Framework;assembly=MyAssembly
    • Build -> Build Solution
    0 讨论(0)
  • 2020-11-28 05:43

    This is a recurring problem for me. One of the time I found the solution looking into the Warning tab. It was a .NET framework version issue and it stated the following:

    Warning 9 The primary reference "myDll" could not be resolved because it was built against the ".NETFramework,Version=v4.5.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

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