A strange error when compiling

T

tony

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'.

//Tony
 
G

Guest

You have an incremental build of the assembly in the run directory that has a
build version number higher than the one that is being built. You can delete
it before building. An easy way to prevent this is to use fixed build numbers
in your AssemblyInfo file so that they don't keep getting incremented each
time you build the project. Then when you are really ready to have a new
"official" build, you can increment the number manually.
Peter
 
J

Jianwei Sun

tony said:
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'.

It seems to me that you are trying to overwrite a newer version
"1.0.2462.14068" with an older version "1.0.2462.13017", If your exe
depends on the dlls, you may want to set the project dependency which is
under Project -> Project dependency.
 
J

Jeroen

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'.


The compile error you mention is one I also had in my project. I got it
because one project referenced a DLL and the other reference the
project for that DLL (the project was in the solution).

Anyhow, I see know that I don't completely understand how this works,
but I do know that you should check how your projects/dlls reference
eachother. Make sure that if you use one project/dll multiple times,
each time you use it it should reference the same one.

Hope that helps some. Maybe someone else can provide a more definite
answer.

-Jeroen
 
C

Chris Dunaway

tony said:
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'.

The error is because it is trying to copy those assemblies to the run
directory, but there are already newer versions of the assemblies
there. Are you using direct references to the .dll or are you using
project references in Visual Studio?

Also, in the assemblyinfo file, make sure you specify all four parts of
the version number. Don't use the auto increment feature of the
version number. In other words, don't specify the version using an
asterisk like this: [assembly: AssemblyVersion("2.0.*")].

Instead, specify all four part explicitly:

[assembly: AssemblyVersion("2.0.0.0")]
 
B

Bruce Wood

tony said:
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.
 
J

james.curran

What is most likely happening is that you have one library which has a
project reference to MMICommon (and is therefore always copying the
latest version to the run folder), and another library which has a file
reference to MMICommon (and is therefore always trying to copy the
older version to the run folder). If MMICommon is still changing,
make sure all projects in the solution reference it's project. If
MMICommon is stable, build a release version, remove it from the
solution, and point all the other projects references in the solution
to the release dll.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top