none
xmlns:custom="clr-namespace:..." Designview problem

    Question

  • Once adding to simple XAML code reference to it's namespace designer stops work. Is it bug?
    See sample
    This code shows designer as expected

    <Window x:Class="Test_CLRNamespace.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Test_CLRNamespace" Height="300" Width="300"
        >
      <Grid>
        <Button Margin="41,52,46,62" Name="button1">Button</Button>
      </Grid>
     
    </Window>

    However, this code does not

    <Window x:Class="Test_CLRNamespace.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:custom="clr-namespace:Test_CLRNamespace"
        Title="Test_CLRNamespace" Height="300" Width="300"
        >
      <Grid>
        <Button Margin="41,52,46,62" Name="button1">Button</Button>
      </Grid>
     
    </Window>
    Sunday, October 15, 2006 1:55 PM

Answers

  • This is known bug in Cider designer. This does not affect runtime at all. Until Cider will not be release finally, I advice you to use XMLEditor as default editor for XAML files. You can do it by clicking mouse right click on .xaml file, "Open With...", choose XML Editor and the press "Set as Default"
    Tuesday, October 24, 2006 6:37 PM

All replies

  • I'm also having this problem.

    :-(

    Tuesday, October 24, 2006 6:31 PM
  • This is known bug in Cider designer. This does not affect runtime at all. Until Cider will not be release finally, I advice you to use XMLEditor as default editor for XAML files. You can do it by clicking mouse right click on .xaml file, "Open With...", choose XML Editor and the press "Set as Default"
    Tuesday, October 24, 2006 6:37 PM
  • Hi,

      I have the same problem.  What I've been doing is switching over to the September CTP of Expression Interative Designer to edit the XAML portions of my projects.  So far, so good.

     - Imad

    Wednesday, October 25, 2006 1:44 PM
  •  

    When i try XML Editor a IE window opens and tell me an error occured(restart app etc).

    September CTP of Expression Interative Designer has gone to "

    We’re sorry, but we were unable to service your request. You may wish to choose from the links below for information about Microsoft products and services." lately.

    This Cider error does mess with my project in a way that i cannot compile it no more saying it cannot find my custom class. It only happends after i reload the designer and messes up something. Ussually it works w/o those errors.

    No other tool has autocomplete though and thats what matters Sad

    Monday, November 12, 2007 5:13 PM
  • RTM version has same bug.
    Workaround: xmlns:custom="clr-namespace:MyNamespace;assembly="

    The empty "Assembly=" does the trick!
    Friday, May 30, 2008 8:08 PM
  • It doesn't work for me

    <UserControl x:Class="UserInterface.RodDesigner" 
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
                 xmlns:c="clr-namespace:UserInterface;assembly="

    Last line, and a thousand variations of it, all give me an error:

    Error 1 Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'UserInterface' that is not included in the assembly.

    VS2008 version:

    Microsoft Visual Studio 2008
    Version 9.0.21022.8 RTM
    Microsoft .NET Framework
    Version 3.5

    Monday, June 16, 2008 5:18 AM
  • I can get it to work if I prepend the project namespace to my project defined namespace as such:

    xmlns:c="clr-namespace:NuclearData.UserInterface;assembly=" 
     
    Monday, June 16, 2008 5:32 AM
  • I don't understand. I've been pulling my hair out over a seemingly related issue.

    I have a 3.5 wpf app with a namespace of, say "company.dept.appname.presentation".

    I have a converter in the same assembly with a namespace of "company.dept.appname.presentation.converters".

    I am being harassed with the "Undefined CLR namespace" error, no matter what I try.

    xmlns:conv="clr-namespace:company.dept.appname.presentation.converters;assembly=" 

    Why on earth can't I reference a namespace that's in the same assembly?

    Originally, they were in the same namespace and I couldn't instantiate a converter. I was told it was not found. So, given this namespace and this converter header, I get "The type 'conv:MasterForeignKeyConverter' was not found. Verify that you are not missing an assembly reference...".

    xmlns:conv="clr-namespace:company.dept.appname.presentation;assembly="  

    <conv:MasterForeignKeyConverter x:Key="masterForeignKeyConverter" /> 

    namespace company.dept.appname.presentation  
    {  
        public class MasterForeignKeyConverter : IValueConverter  
        {  
            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)  
     

    I've been staring at this too long. It's got to be something stupid!

    • Edited by Todd Beaulieu Tuesday, August 26, 2008 3:11 PM Added additional details
    Tuesday, August 26, 2008 3:05 PM
  • Did you try prepending the string with the name of the PROJECT, as I mentioned in the previous message.
    Tuesday, August 26, 2008 3:50 PM
  • When it will be fixed??? This is a serious problem, I can not open the usercontrol anymore, I can not edit it in blend..
    Tuesday, October 07, 2008 3:24 PM
  • It took me a while to realize that 99% of the time this is a bogus message. If *anything* prevents the project from compiling, the wpf designer will report errors when trying to resolve converters. I've seen situations where out of 20+ errors, there is really only one legitimate error and the rest are all casualties caused by that error. Another example of this is when a project can't compile because of a single error and I get:

    1. A converter failure.
    2. A converter failure.
    3. A converter failure.
    4. The real failure.
    5. A missing assembly failure - are you missing a reference? (DUH... NO!)
    6. Another missing assembly.
    7. Another missing assembly.

    So there you have 7 errors to sift through when the real culprit was a missing semicolon.

    It would be great if MS could make the compiler or IDE smarter and ignore what is obvious white noise.

    Friday, October 24, 2008 7:02 PM
  • Check if the classes in the namespace you're trying to add has all the necessary namespaces imported.

    Add a empty class in VS 2008, check all the usings and compare those with your classes of the namespace you're trying to add.

    Elger
    Sunday, February 08, 2009 4:55 PM
  • i'm having a similar problem.  i have a c# project with a resource dictionary, several windows, and several user controls.  i apply styles in the xaml of the user controls.  i then reference those user controls in the windows.  the xmlns namespace is correct and it's working fine in run time, but the windows will NOT render in the design view.  if i remove the styles from the user controls, the windows will render in the design view.  i'm a designer and i need the design view desperately.  i can't figure how to make it work, but seems like it should.  thanks.
    Saturday, August 22, 2009 2:00 AM
  • P.S. i'm using vs2008 v9, .NET v3.5.  i also have Blend v3, which will render the windows but without the user controls that are referenced.
    Saturday, August 22, 2009 2:02 AM
  • I have resolved this issue.  when referencing styles in the user controls, i used {StaticResource StyleName}.  i changed them all to {DynamicResource StyleName} and it renders correctly.
    Saturday, August 22, 2009 2:29 AM
  • I was having the same issue and it was stopping me building my project, i just set the assembly tag to the same as the namespace tag and it worked fine

    xmlns:conv="clr-namespace:ITOfinity.SL.Formatting;assembly=ITOfinity.SL.Formatting"

    Friday, April 30, 2010 2:13 PM
  • Same proble [Visual Studio 2010 Premium]

    xmlns

     

     

     

    all was ok for a week, but another day after build even no change in the window strange clr-namespace error [Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'Rapup' that is not included in the assembly.] occures (namespace is ok and no # in the path). I am not able to use visual studio designer neither blend ...

    edit: There is a bug, this situation occures when I add another refference to the project, then local refference cause probelm. SOLUTION: comment your local refference, remove added refference, add new refference again rebuild solution and then uncomment your local refference

    =http://schemas.microsoft.com/winfx/2006/xaml/presentation
    xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
    xmlns:src="clr-namespace:Rapup"
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:d=http://schemas.microsoft.com/expression/blend/2008
    xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006
    mc:Ignorable="d"
    x:Class="Rapup.MainWindow"
    Sunday, May 23, 2010 9:29 AM
  • Hi everybody!

    I found the solution, it was to rebuild the project. I think there was something that the designer looks for and that is made after rebuilding the project.

    I hope that will help you, at least that solved my problem.

    • Proposed as answer by giustoka Wednesday, October 20, 2010 7:50 AM
    Friday, June 04, 2010 3:15 AM
  • Excellent solution pro. It worked perfectly. A simple lateral thinking.:) 
    Saturday, June 12, 2010 7:38 AM
  • Same problem on VS 2010 Express! :(
    Wednesday, August 11, 2010 11:19 AM
  • I had the same problem. I had changed the "build" folder before compiling anything.  After my first compile to my location, this error occured.

    But...When I changed it back to ...bin/debug (as it originally was)... rebuilt the solution again, the problem went away. After that I could change the buildfolder to the one I actually wanted.

     

    Thursday, September 02, 2010 9:28 AM
  • I still get the problem with VS2010 in a x64 soultion targeting .NET 3.5.  I changed my project to "Any CPU" and it seems to work.  I hope this gets fixed in VS2010 SP1.
    • Proposed as answer by Eric Jensen Friday, March 04, 2011 4:58 PM
    Tuesday, December 07, 2010 8:36 PM
  • As 2CME states, this seems to be a problem with switching between target platforms.

    Check the configuration manager of your solution to make sure that all of your target platforms are the same - this worked for me.

     

    Tuesday, February 15, 2011 3:10 PM
  • These posts were a life saver for me. I've had this problem with clr-namespace for a while. Switching targets from x64 to AnyCPU did the trick. I am running vs2010 with SP1 Beta - so I suspect it doesn't bode well for SP1.
    • Proposed as answer by Ian Jirka Sunday, May 29, 2011 8:54 PM
    Friday, March 04, 2011 4:57 PM
  • Yoiks!  Ditto here.  Changing from x64 to AnyCPU did the trick with VS2010 SP1Rel.  Seems like this has been around for a long time.

    \Gregg
    Friday, March 25, 2011 11:27 PM
  • That was it. Thank you for the suggestion. It worked.
    Monday, March 28, 2011 7:26 AM
  • Why is this still giving me problems with vs2010 on win7 64? the app runs fine but the designer fails to load. This is ridiculous.
    http://www.setiri.com
    Friday, September 16, 2011 9:51 PM
  • A couple of people pointed out earlier in this thread that changing your target from X64 to AnyCPU fixes this.  Worked for me.
    \Gregg
    Friday, September 16, 2011 11:14 PM
  • tried switching every cpu type around, didnt help. finally created a new project just to move the one class into it, that made it work. nothing would fix the local class ref though. I've run into this many times in the past as well, it's just ridiculous.

     


    http://www.setiri.com
    Saturday, September 17, 2011 12:34 AM
  • some problem with vs2008 designer

    do this:

    1. close the designer
    2. rebuild-all (Alt+B+R) the solution

    now there wont be any errors.

     

    Wednesday, September 28, 2011 4:16 AM
  • i agree - i had same problem, some problem with vs2008 designer

    solution is somple:

    1. close the designer
    2. rebuild-all (Alt+B+R) the solution

    now there wont be any errors

     

    Wednesday, September 28, 2011 4:17 AM
  • This solved my problem too! After switching between platforms I'm able to view my designer for any platform now.
    • Edited by Wild_A Friday, February 03, 2012 10:27 AM
    Friday, February 03, 2012 10:23 AM
  • Works like a charm. Good job 2CME.
    Tuesday, May 15, 2012 2:16 PM
  • Thank you for this one!

    I too have realised that one code error might render multiple failures during compiling, so I usually try to deal with the first error, and then recompile. But your list pointing out the real error at position 4 in your case got my eyes opened - my real failure was not at first position either... So now, finally my shitty user control compiles and the app starts as expected. Thanks again!
    Tuesday, October 02, 2012 7:57 AM