Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The tag "xxx" does not exist in XML namespace"yyy" / Reference could not be found

Tags:

I have a winform usercontrol than I want to add to wpf project.

I added the relevant references (WindowsFormsIntegration, SystemWindowsForms and my user control dll) and added this row in my XAML:

xmlns:MyControl="clr-namespace:xx.xx.xx;assembly=xx.xx" 

And then this:

<WindowsFormsHost><MyControl:control></MyControl:control></WindowsFormsHost> 

When I write "MyControl:" the "control" is automated show up that mean VS recognize the control and all references added ok... but when I compile the project this give me the error in the title.

Edit

Its very strange when I'm compile the all project i've got error "The type or namespace name "xx' could not be found..." but I added all the refernces and the VS recognize the namespace so why the compiler don't found them? If this problem will be solved I beleive the other problem also will disappear.

like image 215
Maya Avatar asked Jun 26 '11 11:06

Maya


2 Answers

The solution is: Go to your project properties and change the Target Framework from Client Profile to the full version of the .Net you are using, see the image below. This problem happens if your DLL targets the full .NET Framework, and your WPF Application (main project) targets .Net Client Profile.

Change Your Target Framework to the Full Version

like image 76
Mohammed A. Fadil Avatar answered Sep 19 '22 20:09

Mohammed A. Fadil


This happened to me when I included the assembly name in the namespace definition, but both controls were in the same assembly. Just removing the assembly part of the namespace declaration solved it.

like image 37
Foole Avatar answered Sep 18 '22 20:09

Foole