简体   繁体   中英

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. The concrete error message is:

"The name "FieldManagementViewModel" does not exist in the namespace "using:StudyConfigurationClient.ViewModels"".

This is my 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.

What worked for me:

  1. Remove the problematic XAML tag, so that solution will build
  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.

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

In my case the problem occurred in App.xaml. In the properties for App.xaml the BuildAction had somehow been changed to Page . After restoring the BuildAction to ApplicationDefinition the problem went away. (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. Sorry for not being able to help others, but I haven't got a clue about what happened.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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