tony wrote:
Hello!
I have several projects where each one build a library.(class library or
window control library).
Now I get some strange compile error when building the *.exe file and
doesn't understand what this means.
Can somebody tell me what is causing this?
Do I have made some setup in a wrong way for some of my project where I
build my library.
here are the strange compile error.
Warning: The dependency 'MMICommon, Version=1.0.2462.13017, Culture=neutral'
in project 'MeltPracApplication' cannot be copied to the run directory
because it would overwrite the reference 'MMICommon, Version=1.0.2462.14068,
Culture=neutral'.
Warning: The dependency 'MultiLang, Version=1.0.2462.12705, Culture=neutral'
in project 'MeltPracApplication' cannot be copied to the run directory
because it would overwrite the reference 'MultiLang, Version=1.0.2462.14059,
Culture=neutral'.
You have an (at least) three-level dependency in your DLLs.
MeltPracApplication depends upon MMICommon and MultiLang and something
else, and that "something else" in turn depends upon MMICommon and
MultiLang. If you look at a dependency tree of your projects, it might
look like this:
MeltPracApplication
uses MMICommon
and MultiLang
and SomethingElse
which uses MMICommon
and MultiLang
All four projects use "copy local" for their DLL dependencies. So now,
rebuild the MMICommon and MultiLang projects, and think about what is
where:
- The MMICommon project contains a new MMICommon DLL.
- The MultiLang project contains a new MultiLang DLL.
- The SomethingElse project contains the SomethingElse DLL and the
*old* MMICommon and MultiLang DLLs because it hasn't been rebuilt yet,
and only a rebuild will copy the new ones in.
Now you rebuild MeltPracApplication. What happens? It copies in the new
MMICommon and MultiLang DLLs because it depends upon them directly. It
also copies in the existing SomethingElse DLL because it needs that
too, and then goes on to try to copy in the MMICommon and MultiLang
DLLs from the SomethingElse directory, but they're older than the ones
it has already copied directly from the MMICommon and MultiLang project
directories, so it complains!
The solution is to rebuild SomethingElse, then rebuild
MeltPracApplication.
By the way, the poster who suggested using fixed version numbers is
correct, but is advocating something dangerous: fixed version numbers
will only mask this problem. You would end up with disparate builds of
your dependent DLLs all with the same version number, so now the
builder won't warn you when something like this happens. It will
just... do something, and what that is... well, your guess is as good
as mine.
There are good reasons for using fixed version numbers. This isn't one
of them.
By the way, I'm sure that there are better ways of structuring your
projects so that this sort of thing isn't a problem. Nonetheless, if
this is the way that you have your projects set up, this is what will
happen if you build them out of order.