MC3074 - type does not exist in "clr-namespace..."
data-binding, reference, wpf
Solution
Try this:
xmlns:databind="clr-namespace:GuiParts.DataBinding.Validators;assembly=DataBinding"
<Binding.ValidationRules>
<databind:FileExistsRule />
</Binding.ValidationRules>
Problem
Im having trouble referencing classes in xaml from other assemblies. In the same solution, i have two projects. One called Controls (to hold user controls) and one called DataBinding (holding converters / validation rules). In a control, im attempting reference a validation rule in xaml: ``` <Binding.ValidationRules> <databind:Validators.FileExistsRule /> </Binding.ValidationRules> ``` My project references the project containing my classes. Ive added this declaration at the top of my Control.xaml: ``` xmlns:databind="clr-namespace:GuiParts.DataBinding;assembly=DataBinding" ``` However, when i compile, i get an error: ``` The tag 'Validators.FileExistsRule' does not exist in XML namespace 'clr-namespace:GuiParts.DataBinding;assembly=DataBinding'. ``` The class definitely exists, i can call it in the code behind with no problems, but not via xaml. If i move the class to the same project, again, i have no problems. Ive seen other questions on here, and have tried the following: - Cleaning and rebuilding all relevant projects - Ensuring all projects are targeting the same version of .Net (4.0, Full Profile) - Removing the 'assembly' definition from the end of the namespace definition. None of the above has worked. Any suggestions as to where im going wrong? EDIT My FileExists Validator: ``` namespace GuiParts.DataBinding.Validators { /// <summary> /// Validates that the file with the specified name exists /// </summary> public class FileExistsRule : ValidationRule { public override ValidationResult Validate(object value, CultureInfo cultureInfo) { ValidationResult res = null; res = ( ! File.Exists((string)value)) ? new ValidationResult(false, "File does not exist") : new ValidationResult(true, null); return res; } } } ``` I can call the following in the code behind without any errors: ``` new GuiParts.DataBinding.Validators.FileExistsRule(); ``` So ive got my namespaces etc. correct.