I have a solution with 2 projects in it: ProjA and ProjB. ProjA is an application while ProjB is a library. ProjB also references 3 other DLL files (C, D, E). When I build ProjB C, D, and E all go into the bin directory. When I compile ProjA (which ONLY references ProjB) only C and D are copied, and not E.
I'm really not sure what would cause this to happen. I looked at the reference properties and all 3 (C, D, and E) are identi开发者_Go百科cal (except for their name and path). I guess I'm not sure why ProjB would place E into the bin directory, but when my application (ProjA) builds it does not copy E locally?
I'm going to go out on a limb here and make a wild guess: reference E is not used directly by project B thus the reference does not appear in the PE manifest of project B's output.
Likely you have "Copy Local" on the references in Project B which explains why these assemblies are copied to the bin folder of project B.
However, if you were to open the dll for project B you will notice that reference E is not listed as an assembly dependency. Visual Studio / MSBuild cannot infer that Project A's usage of assembly B requires E.
To resolve the problem, use a class or feature of reference E in Project B.
Alternatively, have project A & B output their assemblies to a common folder. Tip: turn off "Copy Local" in this scenario to improve build performance.
Update:
I've tried several different ways to reproduce your problem but the closest I've got was from this post which suggests that it may be a path probing problem. In the example provided the reference from A to B is a static file reference (bin\Debug\ProjB.dll) and the dependencies (E) are defined as Copy Local=False. The sample project is set up in such a way that all the dependencies have been compiled and packaged in the zip.
When you compile A, the problem you've described is noticeable. The fix, should be to change ProjB's E reference to "Copy Local=True", but if you make this change and recompile -- there's no difference! Why?
It seems as though changing the setting "Copy Local" doesn't actually change the output of ProjB in any way. And because the reference in ProjB is a static reference, it doesn't pick up that any changes have occurred. It's not until you do a Clean that the build compiles normally.
Don't know if that helps. Otherwise, good luck.
精彩评论