[英]The type or namespace name does not exist in the namespace ''are you missing an assembly reference ?"
[英]The type or namespace name does not exist in the namespace - without reference
我遇到了一个奇怪的问题(Visual Studio 2012):
“命名空间 'XX.X' 中不存在类型或命名空间名称 'X'(您是否缺少程序集引用?)...\\MyUserControl.g.cs ....
我有以下用户控件:
<UserControl x:Class="xxxxxx.MyUserControl"
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"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel>
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=h}" FontWeight="Bold" FontSize="12" Foreground="Black" />
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=hd}" FontSize="12" Margin="10,10,0,5" MaxWidth="250" TextWrapping="Wrap" Height="Auto" Foreground="Black"/>
</StackPanel>
</UserControl>
当我尝试构建项目时, .g.cs文件坚持添加引用中不存在的命名空间,并且不在 xaml 中以任何方式使用它。
我试图进行清理和重建。没有任何帮助。
通常这样的问题是在命名空间没有正确写入时,但这里我没有引用任何其他命名空间,所以很奇怪。
还有其他人遇到这个问题并且可以提供帮助吗?
Mat 的评论帮助我解决了这个问题:我在Generic.xaml
找到了参考。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.