views:

52

answers:

2

This one has had me stumped for over a year and seems really odd and really obscure. When I build my solution, it complains about a missing referenced DLL. When I rebuild it, the problem goes away. Whenever I do a clean this returns, i.e. have to attempt a build twice before it succeeds.

This is vague, but if warranted I can give a better explanation of solution structure. Since the workaround is simply to build twice, I've never bothered to give it more attention, buts its extremely annoying.

Also, the build fails because it seems the DLL is just absent, so code that references it after fails because of missing types from the DLL. The next time I initiate the build, it works fine.

Update:

  • The referenced DLL is external (ValidationFramework from CodePlex), located in the source tree.
  • None of my projects are copying the DLL, just some of them reference it.
  • This happens in both Debug and Release builds.

Just found it relevant to also add that project A references the ValidationFramework.dll, as does project B, but project B references project A. Now when the build error occurs, its always when the compiler goes to project B, i.e. project A always builds successfully on both first and second build attempts.

Also, when project B fails, I can click "Build" over and over to no effect, it does require a "Rebuild", so whatever "fixes" the problem that is occurring happens prior to building project B (as the problem itself might as well).

+1  A: 

Is the missing DLL one of the projects being built in your workspace? Do you have the project dependencies set up so that the DLL project has to be built before the utilizing project is built?

jwismar
@jwismar - See update in question.
user144182
Can you successfully build the any of the individual projects that reference the DLL? Have you looked to see if there is an ordering (first build project A, then project B, etc.) that allows your build to succeed on the first try?
jwismar
The build is the same on both attempts, however I just updated the question to reflect your question on ordering and how it effects build process.
user144182
A: 

This sounds vaguely familiar. I may have experienced this with vs.net 2003 or 2005 I don't recall. But it exhibited itself like this:

In debug builds the referenced C++/CLI would be copied to consuming assembly folders correctly but when I did release builds it would suddenly break because the referencing projects couldn't find them. It turned out to be a VS.NET bug that I thought was fixed in a service back but in the interim I added some post build steps to move the assembly by brute force to where it need to be.

Do your debug builds seem to work every time?

dkackman
Updated question, but the problem occurs regardless of debug vs. release.
user144182