RSS

The type reference cannot find a public type named *

20 May

Today I get a very strange exception saying:
The type reference cannot find a public type named ‘SubmitButton’.
But I have not seen the problem: I had following XAML Code:

<Window x:Class="WpfTestApplication.Window"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfTestApplication;assembly=WpfTestApplication"
    Title="MainWindow">
    <local:SubmitButton/>
</Window>

So what is the error. Actually there is no simpler solution than removing the assembly part declaration of the namespace import. Therefore after removing following part

assembly=WpfTestApplication

the result of your code should look like follows:

<Window x:Class="WpfTestApplication.Window"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfTestApplication;"
    Title="MainWindow">
    <local:SubmitButton/>
</Window>

Now the code certainly will compile again.

Advertisements
 
Leave a comment

Posted by on May 20, 2011 in C-Sharp, WPF

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: