Recently I went through a tricky problem while working with VS 2010. I was trying to reference a Class library project in a Console project. So I opened Add Reference window from Console App, selected Projects, on top left corner of the window and located Class Library Project that I wanted to reference and I clicked on Add button. It was there in the Reference list, but with an yellow exclamation mark.
I looked around on Google and found some posts which were suggesting that the physical dll file might not be there while VS is trying to load it and hence, it’s showing that exclamation mark.
But in my case, I was actually trying to reference the Project not the dll file. So I kept looking and found that one of the possible reasons could be that, these 2 projects are targeting two different .NET frameworks. I quickly checked it and sure enough, my Class library was targeting at .NET 4.0 and my Console App had 3.5. As soon as I targeted 4.0 in my Console App, everything started falling into place.
But just to calm my curiosity down, I went ahead played around a bit with the target frameworks in both projects and here’s what I saw.
When you are referencing a project which is targeting a higher (4.0) .NET framework than your Main project (3.5), VS 2010 will show that little yellow exclamation next to the referenced dll. But if it’s the opposite case, it works fine.
Hope this helps.
Happy Coding!!