Reputation: 2497
I'm porting a C++ .NET solution to MSVS 2012. I have a particular problem with an assembly built localy. In the "Common Properties" section, in the reference list, the assembly was added ("Add New Reference" by browsing). But often (not always), the link seems to be broken (with a vertical red bar on the small icon at left beside the assembly name) and the project won't compile.
I remove the reference then re-add it (the same one!) and it build. I would appreciate any hint about how to fix this problem because we have a lot of projects in the solution.
You have encountered this problem?
Feel free to ask for more info...
Thanks.
Upvotes: 0
Views: 66
Reputation: 2497
Here is what solved my problem:
When adding a reference (at least in VS2012), you have 4 choices at your left:
By reflex, I chose Browse because I wanted to browse for the DLL in my folders. I found it (the DLL) then I wrongly beleived that it was correct.
What I had to do was to choose Assemblies. Then I could select Browse at the bottom of the dialog to browse my folders.
At current time I don't know what the first Browse is useful for. Anyway, I hope my mistake will help someone!
And many thanks to those who gave me some hints!
Upvotes: 0
Reputation: 941387
A common reason for this is a referenced assembly that the added assembly needs. And your project has a .NET framework target that doesn't include that assembly. The IDE gets screwy when that happens. Everything looks normal, IntelliSense works for example. Until you compile and the discrepancy is discovered. There is a warning about it in the Error List window but it is easily missed by the usual raft of errors that excluded assembly generates.
System.Web is a common one that isn't available, for example. Change the Framework Target setting from the Client profile to the full version to fix the problem and try again.
Upvotes: 1
Reputation: 1829
Are you adding an assembly which is built by that project or a different one? If so then the problem is that it might not be there or might be occupied (held open exclusively by another process like VS2010).
If it is in the same project dont add it by browsing add it from the projects tab.
If not then try to copy the assembly to a different location and then point to it.
In general pointing to different assemblies which are in another project is a very bad idea.
Upvotes: 1