Errors when adding an assembly reference in Visual Studio
My work machine has finally been upgraded from Windows XP to Windows 7 with a clean installation. And this means reinstalling some tools, taking some time to reorganize and optimize directory structures, etc…
Now I was working on an article (my first deadline!) when I got the following error:
Could not add a reference
The given assembly name or codebase was invalid. (Exception from HRESULT: 0×80131047)
I’m using a custom Add Reference window from the Productivity Power Tools. Maybe it was a bug in the current release of this great extension? After disabling the extension I did get rid of the error but an other one showed up:
Microsoft Visual Studio The system cannot find the file specified
Hmmz… was my Visual Studio installation broken? One of the other extensions I’m using is: PowerCommands for Visual Studio 2010. This extension has a copy/paste functionality for references, so maybe I could just copy the reference for now and finally start working…
Microsoft Visual Studio
Error HRESULT E_FAIL has been returned from a call to a COM component.
Strange, because only a few hours ago I was working on the same project (on my workstation) and everything worked correctly. The only thing that had changed was the directory structure. And indeed, the culprit was the comma in the directory name.
It seems that you cannot add a reference to an assembly located in a directory containing a comma in its name. Maybe because it could conflict with the commas in the fully qualified assembly name?
Mystery solved! To the Bat Cave,Robin!