Namespace not recognized (even though it is there)

前端 未结 20 1686
终归单人心
终归单人心 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 21:45

    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

    0 讨论(0)
  • 2020-11-28 21:46

    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...

    0 讨论(0)
  • 2020-11-28 21:48

    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.

    0 讨论(0)
  • 2020-11-28 21:53

    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.

    0 讨论(0)
  • 2020-11-28 21:55

    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.

    0 讨论(0)
  • 2020-11-28 21:55

    In my case removing/adding that assembly worked.

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