Followup:
I've tried an enormous number of Project settings changes to solve this
problem; none have worked. I've tried changing all the output directories to
a common location, deleting and re-creating the project dependencies, turning
off Local Copy, a pre-build step to explicitly copy the referencing .dlls;
using the Resolve #include Directives setting... all to no avail.
Specifically, we have two C++ projects (ByteSwap and CRC) which build fine.
A third C++ project (RawDataDefinition) depends on both of the others, and
runs later in the build (as desired). When Devenv runs the show,
RawDataDefinition fails starting with the source line:
using namespace IMDHUMS::Utility;
which produces cascading errors starting with:
c:\imd2\project\Download\RawDataReader\Packet.h(54) : error C2039: 'Utility'
: is not a member of 'IMDHUMS'
c:\imd2\project\Download\RawDataReader\Packet.h(54) : error C2871: 'Utility'
: a namespace with this name does not exist
It then fails to locate the methods which were defined in the depending
projects.
We're guessing that the namespace error isn't the actual error, but that the
compiler is failing to make proper reference to the ByteSwap and CRC32 .dlls
which are otherwise correctly referenced in the dependant project's .vcproj
file.
As the others have indicated, the build works fine from within the IDE (and
subsequent command line executions work OK too as long as files from the IDE
build remain on the build machine). We want to build from scratch each night
via a batch process, so interactively running the IDE before the batch build
is not practical; and leaving some output on the machine to allow the batch
build to run is also not a viable option for us.
Your help in working around or isolating this bug (or knowing it's being
worked on within 'Devenv' itself) is appreciated.
-= Bob =-
> Echoing Andy, Matt, and Jon's issue: we too are seeing the exact same problem
> running devenv with mixed managed & unmanaged C++ and C# assemblies. The C#
[quoted text clipped - 15 lines]
>
> -= Bob =-
Bob - 22 Oct 2004 15:11 GMT
We think we understand the issue now, and can suggest a work around for it:
PROBLEM:
In Microsoft Visual Studio .NET 2003, the command-line compiler (devenv)
cannot correctly build C++ projects which have any kind of dependency within
the Solution, UNLESS a binary of the project you are trying to build is
ALREADY PRESENT in its $(OutDir) directory. It appears that dependencies to
C++ AND C# will both cause problems.
WORKAROUND:
Use the IDE to build the solution (or project--your choice). Within the
IDE, the dependencies are handled correctly, and you should get a resulting
binary. Then, capture that project's resulting binary (.dll file). Anytime
you want to rebuild the solution using devenv, place those .dlls you captured
into their $(OutDir) BEFORE calling devenv, and the build will succeed.
EXAMPLE:
SOLUTION.sln consists of C++ Projects A and B, which have no dependencies,
C# Project D, and C++ Project C which depends on A, B, and D. Build
SOLUTION.sln in the IDE, then capture the file C.dll.
To rebuild SOLUTION.sln from the command line, before you run devenv, copy
C.dll to its output directory (what the project has stored for $(OutDir)),
and make sure it is writable. Then run devenv for SOLUTION.sln and it should
succeed.
ISSUE:
Yes, this violates several first rules of automatic rebuilds (no capturing
the output to use as input), but it's the only thing we have found which
works. The RESULTING build is OK (the C.dll file is refreshed fine), so it's
just an inconvenience. Essentially, this is a "Chicken and Egg" type of
problem, where the "Chicken" has to exist before the "Egg" can be produced.
Changes to the C++ module later may require that you rebuild it in the IDE
again and check it into your source code control system before the next build
will work--I imagine that would be neccessary if you change any interfaces or
manifest details in Project C. Stay alert for those.
Thanks to Jon for his help looking for other workarounds! This one seems to
be the simplest for us to do and will require us only to delete the .dlls
from source control once (or if) Microsoft chooses to address the problem and
fix the way devenv discovers dependencies within C++ projects in .NET.
-= Bob =-
> Followup:
>
[quoted text clipped - 40 lines]
> > Echoing Andy, Matt, and Jon's issue: we too are seeing the exact same problem
> > running devenv with mixed managed & unmanaged C++ and C# assemblies.