Separate Directories for Debug and Release DLLs

T

TBass

Hello,

Is there a way to get Visual Studio 2003 look to one directory for
debug version dlls when set to DEBUG and then to another directory
where I store the release version of a dll when set to RELEASE?

My current project uses about 8 dlls I've written in the past, but I
don't want to keep re-compiling them for debug/release depending on
whether I'm compiling the current project for debug/release.

Thanks in advance,
Tom
 
S

SvenC

Hi TBass,
Is there a way to get Visual Studio 2003 look to one directory for
debug version dlls when set to DEBUG and then to another directory
where I store the release version of a dll when set to RELEASE?

My current project uses about 8 dlls I've written in the past, but I
don't want to keep re-compiling them for debug/release depending on
whether I'm compiling the current project for debug/release.

What I do in this situation is to output all release modules which I need
together in one release directory and the same for the debug versions. The
intermediate output files of each project go into a sub directory of the
global release/debug directory named like the project.

So I have an output drive which I name X and there you find this file
structure

x:\release
// here I have *.dll, *.lib, *.exe and *.pdb files of release builds
X:\release\Proj1
// all project output of Proj1
X:\release\Proj2
// all project output of Proj1 and so on

X:\debug
// here I have *.dll, *.lib, *.exe and *.pdb files of debug builds
X:\debug\Proj
// Proj1 output and so on

So if you build an exe into the debug directory and run or debug it, it
should already find all debug dlls it needs.

Does that answer your question or do I miss something?
 
T

TBass

[snip]
So if you build an exe into the debug directory and run or debug it, it
should already find all debug dlls it needs.
[/snip]


But how does it find the dll in the release or debug directory?

For example, If I'm working on Proj1, and it needs to utilise the dll
mylib.dll, you would set up:

x:\release
-mylib.dll
-mylib.lib
-mylib.exp
-----+\Proj1
-----+----Proj1.exe


x:\debug
-mylib.dll
-mylib.lib
-mylib.exp
-----+\Proj1
-----+----Proj1.exe

But if I run Proj1.exe, won't I get the error "Proj1.exe could not run
because mylib.dll could not be located." ? Will it find it if it's in
the directory above?

You could add the debug and release versions to the paths in the
configuration, but how would you get it to prioritize on the DEBUG
directory in the debug mode and the RELEASE directory in release mode.
I must be missing something.
 
D

David Wilkinson

TBass said:
[snip]
So if you build an exe into the debug directory and run or debug it, it
should already find all debug dlls it needs.
[/snip]


But how does it find the dll in the release or debug directory?

For example, If I'm working on Proj1, and it needs to utilise the dll
mylib.dll, you would set up:

x:\release
-mylib.dll
-mylib.lib
-mylib.exp
-----+\Proj1
-----+----Proj1.exe


x:\debug
-mylib.dll
-mylib.lib
-mylib.exp
-----+\Proj1
-----+----Proj1.exe

But if I run Proj1.exe, won't I get the error "Proj1.exe could not run
because mylib.dll could not be located." ? Will it find it if it's in
the directory above?

You could add the debug and release versions to the paths in the
configuration, but how would you get it to prioritize on the DEBUG
directory in the debug mode and the RELEASE directory in release mode.
I must be missing something.

TBass:

You want to have the .exe file and the .dll file in the same directory.
If you want, you can use a post-build event in the .exe project to copy
the 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