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?)
Restarting Visual Studio 2019 - that did it.
This happened to me in Visual Studio 2019. For me, I was trying to reference another project in my solution. Here are the steps I took in case it helps anyone else:
I was confused because I was still getting the error after steps 1 and 2, but building the project seemed to resolve it.
In my case I got the error only in VS 2015. When opening the project in VS 2017 the error was gone.
I resolved this issue by right clicking on the folder containing the files and choosing Exclude From Project and then right clicking again and selecting Include In Project (you first have to enable Show All Files to make the excluded folder visible)
Perhaps the project's type table is in an incorrect state. I would try to remove/add the reference and if that didn't work, create another project, import my code, and see if that works.
I ran into this while using VS 2005, one would expect MS to have fixed that particular problem by now though..
This question has already been answered for the original poster, but in case someone encounters this in an MS-Test project:
from within Visual Studio, click the Test menu -> Test Settings -> Default Processor Architecture and ensure that the architecture matches that of the other assembly that you're referencing. If the other assembly is x64 and your test settings are x86, you may experience the symptoms that the original poster had.