Namespace not recognized (even though it is there)

前端 未结 20 1912
终归单人心
终归单人心 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条回答
  •  旧时难觅i
    2020-11-28 22:03

    I've had a similar issue, that took a bit to troubleshoot, so I thought to share it:

    The namespace that could not be resolved in my case was Company.Project.Common.Models.EF. I had added a file in a new Company.Project.BusinessLogic.Common namespace.

    The majority of the files were having a

    using Company.Project;
    

    And then referencing the models as Common.Models.EF. All the files that also had a

    using Company.Project.BusinessLogic;
    

    Were failing as VS could not determine which namespace to use.

    The solution has been to change the second namespace to Company.Project.BusinessLogic.CommonServices

提交回复
热议问题