John Peters John Peters - 1 month ago 22
C# Question

VSIX CS0426 The type name Views does not exist in the type 'ABC'

I'm creating a VSIX plug-in and just added a WPF control like this:

<UserControl x:Class="ABC.Views.Configuration.MyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ABC.Views.Configuration"
mc:Ignorable="d"
Loaded="UserControl_Loaded"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
</Grid>
</UserControl>


When I compile the project I am getting the error:
CS0426 The type name Views does not exist in the type 'ABC'

I've checked the projects' default namespace and other relevant configurations and everything looks good. In fact, I have other User Controls in the same directory that are compiling just fine.

What am I doing wrong?

Answer

The root cause of this problem was this line in XAML above:

Loaded="UserControl_Loaded"

For some reason VSIX doesn't like wiring events in XAML. I simply removed this and wired it up in Code-behind

Comments