Namespace not recognized (even though it is there)

前端 未结 20 1908
终归单人心
终归单人心 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.

提交回复
热议问题