Namespace not recognized (even though it is there)

前端 未结 20 1690
终归单人心
终归单人心 2020-11-28 21:27

I am getting this error:

The type or namespace name \'AutoMapper\' could not be found (are you missing a using directive or an assembly reference?)

相关标签:
20条回答
  • 2020-11-28 22:10

    The question has already been awarded, but there are additional details not yet described that need to be checked.

    I too was having this behavior, where project B was referenced in project A, but the namespace of project B was not recognized in project A. After some digging, I found my path was too long. By reducing the path of the projects (both A and B) the references became visible and available.

    I tested this theory by creating project C at a much lesser path depth. I referenced project C in project A. The references worked correctly as expected. I then removed project C from the solution, merely moved project C to a deep path, the same as project B, and added project C back to the solution, and tried to compile. I then had no visibility to project C objects any longer.

    0 讨论(0)
  • 2020-11-28 22:12

    I have a similar problem with references not being recognized in VS2010 and the answers herein were not able to correct it.

    The problem in my solution was related to the extension of the path where the project referenced was located. As I am working with SVN, I made a branch of a repository to do some testing and that branch increased two levels in path structure, so the path became too long to be usable in windows. This did not throw any error but did not recognize the namespace of the project reference. When I correct the location of the project to have a smaller path everything went fine.

    0 讨论(0)
提交回复
热议问题