I wonder, why the hell... did the VS team consider that NOT finding a project reference as a non crucial thing?
The referenced component 'X' could not be found. should be considered an error... and nothing else.
<strong>Is there a way (without turning 'Treat all warnings as errors' on) to get this warning as an error in VS2008?</strong>Answer1:
That warning comes from the project system, not the compiler. The project system doesn't know whether or not the reference will actually be needed when the code is compiled. I've run into several cases (all involving multiple platforms and conditional compilation) where this features allows you to maintain a single project file when you might otherwise have to split into one file per configuration.
There is an option to "treat warnings as errors" -- you should be able to find it in the project configuration screen.Answer2:
Why do you think it should be any error? If you had actually used anything in the assembly, then you'd get an error where you use it. So far, all you've said is "I <em>may</em> need this file", and VS is responding "Well, I hope you don't, because I can't find it".Answer3:
This warning does my head in.
I have a project with six configurations - each configuration uses a different version of a particular referenced DLL, and so the references are conditional (by hacking the project file, as I cannot find a way to do it through the VS GUI).
The five references that are not used for the current configuration, despite being present on disk, are always displayed with an exclamation mark in the GUI, and this warning (which does not appear to have a warning ID) is displayed.
I would love to be able to "fix" Visual Studio so that it could determine that due to the configuration currently being built, it is irrelevant that this reference may or may not be present (even though it is present).
Seriously, sometimes Microsoft's obtuseness drives me up the wall.