15
votes

I have implemented a converter to convert Int32 to String to be able to binding a property to a textBox.

I implement this converter in the namespace MyApp.Converters and it is called Int32ToStringConverter.

Then, in my axml I add the reference to my converter as follow:

<Window x:Class="MusicaDB.Views.PrincipalView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        **xmlns:converter="clr-namesapce:MyApp.Converters, aseembly=MyApp**">

Later, in windows.Resources I have:

<Window.Resources>
        <**converter:Int32ToStringConverter** x:Key="Int32ToStringConverter" />
</Window.Resources>

I get the error that the tag Int32ToString converter does not exist in the namespace MyApp.Converters,assembly=MyApp.

I have the project in the local hard drive, in the project properties, the destination .NET is framework 4.0, not framework 4.0 client profile and I try to clear the solution and recompile but the problem persists.

Mainly, this is the two solutions that I always find, but don't resolve my problem.

10

10 Answers

27
votes

Another possible solution to this problem is that you're not using the same version of .Net in your project and your library.

26
votes

Three fixes to make here:

  1. No spaces -> xmlns:converter="clr-namesapce:MyApp.Converters,aseembly=MyApp"
  2. No misspellings -> xmlns:converter="clr-namespace:MyApp.Converters,assembly=MyApp"
  3. Right delimiters -> xmlns:converter="clr-namespace:MyApp.Converters;assembly=MyApp"

From the the documentation:

Note that the character separating the clr-namespace token from its value is a colon (:) whereas the character separating the assembly token from its value is an equals sign (=). The character to use between these two tokens is a semicolon. Also, do not include any whitespace anywhere in the declaration.

13
votes

I am exploring as to why this is happening, but if your converter is in the main assembly, removing the assembly= from your xmlns:converters tag should remove that build error.

4
votes

For the record ... I've face a similar problem and if I removed the ";assembly=X" part from the XAML it worked fine

But don't really understand the reason.

As suggested in this blog: http://zoomicon.wordpress.com/2012/07/02/fix-the-tag-xxx-does-not-exist-in-xml-namespace-clr-namespaceyyy/#comment-7761

4
votes

All answers are right. And after trying all of them and you cannot configure why its happening, everything seems alright, Please restart the Visual studio.

That worked for me after wasting almost 1 hour. I found everything ok, but restarted the VS with administration.

3
votes

I see two possible causes. The first is that you misspelled "assembly" as "aseembly" in the first starred line. Changing the spelling might be enough. The second possibility is that you haven't added MyApp.dll to your project references, which appear like this

enter image description here

in Visual Studio.

2
votes

In my situation, I had the same problem with xmlns:local="clr-namespace:<mydefaultnamespace>". I solved this changing the order of the includes. I put it first and all was solved. A strange behaviour, but this was my workaround that I found in my situation.

2
votes

use the assemble tag only if it is in another project. other wise use just namespace tag alone. For me this fixed the issue

1
votes

In my case, the assembly which contained the namespace was not physically there.

I checked the references of the assembly that had the build error and looked at the properties of the referenced assembly in question.

I navigated to the path and discovered the assembly was indeed missing (which I realised was my own doing), giving rise to the misleading error.

1
votes

There is one very obscure case when you get this error - if you're using Microsoft.mshtml.dll and you upgrade to Windows 10 anniversary edition, or as it turns out the Creator edition too.

Even if this isn't what happens to you make sure the library containing the component that cannot be found can be fully compiled. Look in the error list (not the grid but the Output console) for any clues.

In my case I was using Microsoft.mshtml.dll as part of an HTML editor and it was unregistered somehow (in the GAC).

The following article explains with screenshots:

https://techninotes.blogspot.com/2016/08/fixing-cannot-find-wrapper-assembly-for.html#comment-form

In short I had to run a Visual Studio command prompt (as admin) run these commands:

cd C:\Windows\assembly\GAC\Microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a
regasm Microsoft.mshtml.dll

I did say obscure :-) The important point is to read the errors that may be buried amongst all your warnings because there might be an important clue.

This can be especially confusing if an Operating system update suddenly breaks your project.