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?)
I was working on Xamarin project and as always, deleting obj folder and rebuilding solved my issue, the namespace my VS was not recognizing was a code in my own project BTW
In my case i had copied a classlibrary, and not changed the "Assembly Name" in the project properties, so one DLL was overwriting the other...
In my case, the referenced dll was build in higher version of .Net Framework. After I added the reference, I could use it. But as soon as I did a build, the 'missing reference' error will pop up. I refresh the dll the error will go but it would never build. This post made me check the framework version and thus I could resolve it by building the referenced project in same version.
Crazy. I know.
Tried all options here. Restarting, cleaning, manually checking in generated DLLs (this is invaluable to understanding if it's actually yourself that messed up).
I got it to work by setting the Verbosity of MSBuild to "Detailed" in Options.
I faced similar problem of namespace/method not being found during execution although it was fine during compilation, and the reason for this appears to be that the assembly I was referencing was deployed to GAC and since then was changed, so when I referenced the assembly in Visual Studion it was using the most recent one, but during runtime the version fro GAC had been used.
In my case removing/adding that assembly worked.