3

The problem

Suddenly, Visual Studio (2015 RC) started throwing error CS7069 in my face a lot. It states

Reference to type '...' claims it is defined in '<assembly>', but it could not be found.

Yet VS's functionality "Goto reference" did function and squigglies weren't consistently present, so I figured something weird was going on.

How I created the problem

It started when I was refactoring/splitting a project. I was moving .cs files from one project to a new one. Types that I moved to the new project couldn't be found anymore by the compilation process of a project that referenced both projects.

What I tried

I verified that the relevant assembly was indeed referenced, present and had the type with public modifier. I rebuilt it, checked version numbers (of target frameworks etc), removed the relevant reference and re-added it, cleaned solutions and projects, checked configuration manager settings, removed all VS's temporary files and whatnot, and I couldn't fix the bug for 4 days. 4 long days, might I add.

Googling didn't result in anything either, so I hope that the next poor fellow who made the same mistake as I did finds this page, as I finally found out what was going on:

JBSnorro
  • 6,048
  • 3
  • 41
  • 62

4 Answers4

3

I had two projects with identical assembly names...

Renaming the new assembly in its properties menu made all errors vanish.

JBSnorro
  • 6,048
  • 3
  • 41
  • 62
3

Fixed bug on Visual Studio 2015. Go to Tools menu, Options, Debugging, General: Check: "Use the legacy C# and VB expression evaluators"

user3691460
  • 141
  • 1
  • 6
0

Try to clean/rebuild the project. It helped me.

Also try to remove all of the *.suo and *.user files in your solution folder http://blog.galasoft.ch/posts/2014/01/quick-tip-what-to-do-when-visual-studio-freaks-out-and-everything-is-red/

vmg
  • 9,920
  • 13
  • 61
  • 90
0

I had this problem and it turned out I had the wrong build configuration selected. The reference projects and the project I was building were not selected for that build configuration. Simple to fix, but not something I looked at for a while.