c# - what - xmlnsdefinition




Undefined CLR namespace-No solution found (2)

xmlns:my="clr-namespace:ColorPicker;assembly=ColorPicker".

This worked for me! It's faster and less annoying!

I've been researching for a while now trying to find a reason why the following would be occuring, but no solutions on StackOverflow or Google are able to help me.

I have a custom UserControl that is attempting to reference a namespace within the same project:

xmlns:my="clr-namespace:ColorPicker"

however when I compile I get the following error:

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

This is resulting in not being able to build my project or reference other custom controls within the xaml, generating these kinds of errors:

The type 'my:ColorSelector' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

I've attempted all the solutions given in these posts:

adding a custom namespace to xaml

WPF xmlns: The 'clr-namespace' URI refers to a namespace that is not included in the assembly

The 'clr-namespace' URI refers to a namespace that is not included in the assembly

Undefined CLR namespace

Also, just to be clear, I'm not getting any other errors about other files in this project, so it doesn't seem like it could be the result of other files not compiling.

UPDATE: A sample project that produces the error for me can be downloaded here: http://www.filefactory.com/file/28fbmhj3f4qj/n/ColorPicker_zip


I had to move mine to an external resource dictionary. I fixed my issue by changing:

<UserControl.Resources>
    <SHCL:GoodBadConverter x:Key="GoodBadConverter"/>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/StandardHelperClassLibrary;component/WPF/Dictionaries/WindowStylesDictionary.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</UserControl.Resources>

to

<UserControl.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/StandardHelperClassLibrary;component/WPF/Dictionaries/WindowStylesDictionary.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</UserControl.Resources>

where was moved to one of the resource dictionaries listed.





namespaces