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

C#.NetWpfXamlConverter

C# Problem Overview


I'm trying to include in my XAML some classes which convert values. However, I'm getting the following error when I compile:

> Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'View.Summary.Converters' that is not included in the assembly.(View\View)

And the XAML it's erroring on:

xmlns:c="clr-namespace:View.Summary.Converters"

Also, here is the outline of my conversion classes/namespace:

namespace View.Summary.Converters
{
    class CollapsedIfNegative : IValueConverter { }

    class VisibleIfNegative : IValueConverter { }

    class ErrorCodeToString : IValueConverter { }
}

I had to remove the guts of the code because the project I am working on is highly confidential.

C# Solutions


Solution 1 - C#

rebuild the solution and the error will go away.

Solution 2 - C#

I just solved this by changing the target from x64 to x86. Apparently Visual Studio is 32bit process and it's unable to load 64bit assemblies, and if your assembly is targeting x64 platform and you adding some custom control visual studio is unable to load it and throws this message.

Solution 3 - C#

If you reference to an external project, you must specify the assembly as it appears in your project's references:

xmlns:mdls="clr-namespace:MyProject.Models;assembly=MyProject.Models"

Solution 4 - C#

I figured out what was wrong. Although visual studio showed this as the first error, there were indeed other errors with my coding which prevented the converters from being assembled. Thus, when VS went to find the assembly, it was not there.

Solution 5 - C#

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.

Solution 6 - C#

I was able to reproduce your issue:

I created a simple WF in .NET Framework 4.0. Renamed the xaml file. As part of renaming the xaml file you have to manually rename the workflow runtime name when calling the Invoke on the WorkflowInvoker object. I build the project. I got the error "The 'clr-namespace' URI refers to a namespace 'System' that is not included in the assembly."

How I fixed it:

I open the project property page. For some reason, the target framework was switch from .NET framework 4.0 to 4.0 client version. So, I selected .NET 4.0 and rebuilt the project. The error is not there anymore.

Solution 7 - C#

Check that your build configuration has the Project selected for build in your current (Active) build configuration.

I just had this problem after fiddling with the Build architecture (from x86 to x64) and the main wpf project had been de-selected.

Solution 8 - C#

I have ran into this issue on a C# WPF project. It seems to be generated when you closed the project with last attempt with Errors of any kind during your project not even in the relevant Namespace in issue in XAML.

The solution to this is to fix all .CS files (Or exclude the problematic XAML/CS files) to get a running version Rebuild and run.

It took me close to 3 hours to figure that the Debug version that the designer seems to be running on must be faulty. This is why in many cases people resolved this with Rebuild project, but in cases that you have existing code errors in project the issue will not resolve it self since the Rebuild fails to complete and does not replace the designer supported version.

hoped this helps!

Solution 9 - C#

Visual Studio keeps reverting back to the odd assembly file paths. Just delete the actual reference file it's referring to and then add it to the project

Solution 10 - C#

I had the same error. But apparently, it was just because of the path of the solution that I was trying to build. My path/directory/folder name contains some spaces.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAdam SView Question on Stackoverflow
Solution 1 - C#AvinashView Answer on Stackoverflow
Solution 2 - C#EvgenyView Answer on Stackoverflow
Solution 3 - C#JertherView Answer on Stackoverflow
Solution 4 - C#Adam SView Answer on Stackoverflow
Solution 5 - C#joyView Answer on Stackoverflow
Solution 6 - C#H AView Answer on Stackoverflow
Solution 7 - C#AshView Answer on Stackoverflow
Solution 8 - C#Yonathan DruckView Answer on Stackoverflow
Solution 9 - C#Bhavdeep SinghView Answer on Stackoverflow
Solution 10 - C#fleurView Answer on Stackoverflow