views:

108

answers:

3

Hi.

I have a solution with multiple class libraries. When I compile each individual library (and the web site by itself) compilation always succeeds. But, when I compile the solution as a whole, one of the library references fails with a little yellow exclamation mark next to the failed library. In the Error List I have:

The type or namespace name 'DLL NAME' could not be found (are you missing a using directive or assembly reference?)

Metadata file 'C:\Projects\Project\trunk\source\Core\bin\Debug\Company.ProjectCore.dll' could not be found

What is odd is that the second time I compile (directly after this message) my solution compiles successfully. So, compile once - fail. Compile twice - succeed.

Can somebody suggest what i have to do to resolve this?

Thanks in advance.

A: 

How you add it into project: by targeting the dll from Debug folder or using Add reference/Projects? When yuo use targeted dll and auto increment versions on compile, reference could be broken for wrong compile order (dll version increments after code, that uses it). But I could be wrong. Possible it is a strange VS bug.

Stremlenye
I don't think it is a bug although the behavior is strange. I do "add as reference" from the references folder so it is targeting the binaries directory which is in a different directory path than the solution folder. But, I have "Copy As Local = True" in the Properties list so the DLL is in my local Debug path.
Code Sherpa
Hmm... it just occurred to my that I may need to give ASP.NET permissions on my binaries folder... I am going to check that out and see if that was my problem...
Code Sherpa
No, that wasn't it...
Code Sherpa
A: 

OK, this was a permissions issue.

My solutions folder is a sibling folder to my binaries folder. I am referencing my DLLs there and indicating "Copy to Local" so they appear in my Debug folder at compile time. But, seems I forgot to set the permissions appropriately for the DLL that was giving me problems and ASP.NET couldn't access it when I was compiling - hence the yellow exclamation mark. I am not sure why I could compile the second time (even if "copy to local" would put it in the local debug folder allowing for the compile the second time around, why would this happen if the permissions are against allowing access to the original location of the DLL?).

Anyway, thanks for the help

Code Sherpa
A: 

I would have thought this was a build order issue.

Eg. The website was trying to build first, and can't find the DLL because it has not been built yet.

Lee