简体   繁体   English

名称空间“using:Y”中不存在名称“X”

[英]The name "X" does not exist in the namespace "using:Y"

After reading every article here and trying every suggested action I'm out of things to try:在阅读了这里的每篇文章并尝试了每一个建议的操作后,我都无法尝试:

I have a namespace issue in Visual Studio 2015 - in a XAML file in UWP.我在 Visual Studio 2015 中有一个命名空间问题 - 在 UWP 的 XAML 文件中。 The concrete error message is:具体的错误信息是:

"The name "FieldManagementViewModel" does not exist in the namespace "using:StudyConfigurationClient.ViewModels"". “名称“FieldManagementViewModel”在命名空间“using:StudyConfigurationClient.ViewModels”中不存在”。

This is my XAML:这是我的 XAML: XAML。

This is the structure to show, that the folder and file actually exists, folder structure equals namespaces in this project:这是要显示的结构,文件夹和文件实际存在,文件夹结构等于此项目中的命名空间:

结构体。

I've looked all references and namespaces through, I've repaired Visual Studio 2015, I've cleaned and rebuilt several times and changed platform for the build back and forth - I'm out of options.我已经查看了所有引用和命名空间,修复了 Visual Studio 2015,我已经清理和重建了几次,并且来回更改了构建平台 - 我别无选择。

What worked for me:什么对我有用:

  1. Remove the problematic XAML tag, so that solution will build删除有问题的 XAML 标记,以便构建解决方案
  2. Rebuild project重建项目
  3. Restore the tag恢复标签

I think VS falls into a chicken & egg situation here, in that it needs newly added classes built so that XAML can see them, but it can't build them because XAML can't see them.我认为 VS 在这里陷入了鸡与蛋的情况,因为它需要构建新添加的类,以便 XAML 可以看到它们,但它无法构建它们,因为 XAML 看不到它们。

只需将此解决方案添加到此问题: - 关闭并重新打开 Visual Studio

In my case the problem occurred in App.xaml.就我而言,问题发生在 App.xaml 中。 In the properties for App.xaml the BuildAction had somehow been changed to Page .在 App.xaml 的属性中, BuildAction以某种方式更改为Page After restoring the BuildAction to ApplicationDefinition the problem went away.BuildAction恢复到ApplicationDefinition ,问题就消失了。 (See also this related answer .) (另请参阅此相关答案。)

Thanks for helping - this issue magically went away when I pulled a change from git, which shouldn't affect this in any way.感谢您的帮助 - 当我从 git 中提取更改时,这个问题神奇地消失了,这不应该以任何方式影响它。 Sorry for not being able to help others, but I haven't got a clue about what happened.很抱歉不能帮助别人,但我不知道发生了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM