How do you fix a schema / namespace error in Visual Studio 2010? (WPF / XAML)

I'm not sure why, but recently, Visual Studio cannot find the schema used in XAML in the root window.

This is the error message I get:

Message 1 Could not find schema information for element 'http://schemas.microsoft.com/winfx/2006/xaml/presentation:Window'.

The error causes IntelliSense to not work. However, the project is still compiling and working as expected. In every project that I open, the problem is the same. Starting with a new project, I am provided with the following XAML:

<Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> </Grid> </Window> 

But I get the same error.

I tried, with no luck, all of the following:

  • Reinstall Visual Studio 2010
  • Reinstall .NET
  • Removing the Visual Studio directory (\ Users \ [User] \ Documents \ Visual Studio 2010).

What do I need to do to fix this?

+4
source share
3 answers

This was happening to me because I configured Visual Studio to open the XAML files in an XML editor (Text).

To fix the problem, right-click on the XAML file in Solution Explorer, select Open With, select Automatic Editor Selector, and click Set as Default.

If you want to open XAML documents in full XAML view, go to Tools → Options → Text Editor → XAML → Miscellaneous and check the box “Always open documents in full XAML view”.

+4
source

What version of TargetFramework is ".Net Framework 4" or ".Net Framework 4 Client Profile". If this is a client profile, change it to ".Net Framework 4", you may have one more luck.

+1
source

You can also get this error if you open a xaml file that is not included in the project, since it opens by default in a text editor. Then they added it to the project. I fixed the project closing and reopening.

0
source

All Articles