Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve XAML designer error: The document contains errors that must be fixed before the designer can be loaded

I have a XAML file that references custom controls defined into another assembly. It compiles and works perfectly at runtime, but the XAML designer is choking and does not show the design content.

<Window x:Class="MyProgram.AboutWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:copy="clr-namespace:MyCompany.Common.CopyProtection;assembly=Common"
    Title="About Box" Height="400" Width="400" SizeToContent="Height">
    <copy:RegistrationPanel  />
</Window>

The class MyCompany.Common.CopyProtection is loacted inside the Common assembly, which is in the references for this project. The class is public, and freshly built.

I am using Visual Studio Express 2008 with .NET 3.5 SP1. Here are the errors:

Problem Loading

The document contains errors that must be fixed before the designer can be loaded. Reload the designer after you have fixed the errors.

Error 1 The type 'copy:RegistrationPanel' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
Error 2 Assembly 'Common' was not found. Verify that you are not missing an assembly reference. Also, verify that your project and all referenced assemblies have been built.

Anybody knows how to solve those errors so I can start using the designer again. The designer is pratical to select XAML elements and quicly jump into XAML code.

like image 942
decasteljau Avatar asked Mar 15 '09 12:03

decasteljau


1 Answers

The WPF designer included with VS2008 is inadequate for all but the simplest of tasks. My advice is don't use it and instead use something Blend if you can, or perhaps Kaxaml for smaller XAML tests.

I turn the XAML editor off completely by mapping the .xaml extension to the standard XML Editor. This improves load times, and avoids all these annoying "errors" spewed out by the XAML designer.

like image 174
Kent Boogaart Avatar answered Sep 28 '22 22:09

Kent Boogaart