我的 WinRT 应用程序使用的共享项目中有一个值转换器。也就是说,转换器位于另一个项目/程序集中,而不是使用它的项目/程序集。我已将其他项目的命名空间添加到我的 XAML,IDE 未将其标记为未解析:
<UserControl xmlns:CommonConverters="using:Common_WinStore.Converters">
我还为它添加了一个资源条目:
<UserControl.Resources>
<CommonConverters:DebugBindingConverter x:Key="DebugBindingConverter"/>
</UserControl.Resources>
但是,IDE 编辑器将 CommonConverters:DebugBindingConverter 标记为错误:
The name DebugBindingConverter does not exist in the namespace "using:Common_WinStore.Converters"
真正烦人的是,当我键入 CommonConverters: 时,Intellisense 会在列表中弹出 DebugBindingConverter,我用它来自动完成资源引用。
为什么Intellisense能找到,IDE编辑器或编译器却找不到?
最佳答案
我之前遇到过这个问题。当您在项目(解决方案)中添加新文件但不保存项目(解决方案)时,有时会发生这种情况,intellisense 会解析它但编译器不会编译,因为它尚未包含在项目文件中。所以保存所有文件应该有所帮助。有时问题会在重新启动 visual studio 并重建项目/解决方案后消失。
关于c# - 值转换器显示在 Intellisense 中,但编译器无法在 C# WinRT 应用程序中找到?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21355954/