Fog Creek Software
Discussion Board

VB6 Build and Debugging Question

Maybe the JOS (JoelOnSoftware) forum is not the best place for this type of detailed development question, but i will ask anyways and see what people have to say..

Is it possible for the VB6 IDE compiler to build the final EXE (or dll) in a different directory (like a common BIN directory) other then the current project (.vbp) directory and still have the VB6 IDE debugger to find and run this different target when i want to debug it???

I do this all the time with the Visual C++ (DevStudio) debugger.  I don't know how to do it with my VB6 projects

Here is my project tree relative to "H:\develop\GCS" where GCS is the product name:

|  +---fly
|  +---ini
|  +---maps
|  \---vrs

The "src" directory contains the VB6 project (.vbp) and all the source code (*.frm, *.cls, *.bas) and binary resources (*.ico,*.bmp,*.gif,*.res,etc) needed to compile the final .exe

The "bin" dir is what my final setup program would create on the target computer.  I ultimatly want my InstallShield project to build the final setup from all the files in the "bin" directory structure.

I would like to have VB6 build the final .exe in the parent "..\bin" directory so when i debug and run the application it can access the relative sub dirs (fly,ini,maps,vrs).

This would simplify my develop-test-debug process as well as simplify my automated installshield setup build process.

Any VB6 pros left out there???

P.s. for the curious minded out there.. all I can tell you is that GCS stands for "Ground Control Station".... which is software for the UAV (Unmanned Aerial Vehicles) industry.
See for more info, or 

Heston Holtmann
Friday, November 08, 2002

When you make a file it prompts you for a directory to save the executable in. If you save the project it will remember where it saved the last executable. It will also remember the NAME of the executable.

I use VB6 SP5 so if yours doesn't do this try the latest service packs.

Rob Conley
Friday, November 08, 2002

Thanks, that helps with my final installshield setup build process..but...

... the VB6 IDE debugger still does not actually use the .exe in the target "GCS\bin" dir because the app.path still points to the directory location of where the .vbp project file is; "GCS\src". 

If there is no high level VB IDE solution (like in VisualStudio).. i may have to resort to conditional code to check for DEBUG vs RELEASE builds and change my relative path strings in source code to accomodate my needs.  Or conditionally change the current working dir based on DEBUG vs RELEASE flags.

I'm Still open to other "undiscovered" suggestions.

Heston Holtmann
Friday, November 08, 2002

Heston, the VB IDE debugger operates on the source code, not the compiled executable.

Friday, November 08, 2002

I guess i was getting my hopes up that I could get the VB6 debugger/IDE to work more like the VC++6 debugger that i'm so use to working with. 

The VStudio6 debugger lets you specify the target .exe to debug and at the same time set an independent working directory in the "Project Settings->Debug tab:general" options:

The interesting thing is if I compile to Native Code in VB6 and turn on "Create Symbolic Debugging Info" i can actually debug my VB app (with full VB source) in the VisualStudio IDE debugger.  You do lose some information that the VB debugger gives you.. but in many ways it works better then debugging in the VB6 IDE.

Anyways.. to put this topic to rest.. the following was my VB6 solution:  I define 2 symbols in my VB project "MPDEBUG" and "MPRELEASE" and call the following function as the first operation in my apps entry point function.

Public Sub ChangeDirToApp()
#If MPDEBUG = 0 And MPRELEASE = 1 Then
  ' assume that in final release builds the current dir will be the location
  ' of where the .exe was installed; paths are relative to the install dir
  ChDrive App.path
  ChDir App.path
  ' in all debug/IDE related builds, we need to switch to the "bin" dir
  ChDrive App.path
  ChDir App.path & BackSlash(App.path) & "..\bin"
#End If
End Sub

I gues you I can't shake my VC++ programming habits out of me even when i'm trying to think VB!

Heston Holtmann
Friday, November 08, 2002

My Directory goes like this.


Under AppEXE has the directory tree and files the same as if it was installed. Since most of the directories I use are definable in the program I have a special configuration that I use while developing.

While I do see the point of how Visual C++ does it. Understand that the VB debuggers allows you to alter the source while debugging in that regards is a lot more powerful.

One of the few misses with version 1 of.NET is the removal of this from VB.NET.

Rob Conley
Saturday, November 09, 2002

*  Recent Topics

*  Fog Creek Home