Deployment/Debugging Question

D

daokfella

Let me preface this by saying I've been primarily an ASP.Net developer
over the last few years and have just started working with Winforms.

My application will be a standalone program that will access FoxPro
database files. A typical installation would install my exe in
C:\Program Files\My Company\My Application. I want my database files to
go in C:\Program Files\My Company\My Application\Data. I've added the
Data folder to my project and selected the build action as content for
each Foxpro item inside it.

My question is with determining the path to the database files for my
connection string. I'll be able to determine the Data folder path using
Application.StartupPath. However, when debugging, the exe is compiled
and executed from the bin folder. Thus, the database path is incorrect
when using Application.StartupPath.

How can I simulate the install structure when developing and debugging?
 
D

daokfella

I've gone ahead and used
#If DEBUG Then
' Path relative to bin directory
#Else
' Path relative to project root
#End If
 
B

Bryan Phillips

Yes, it is a VS2005 feature. In VS2003, I used to add a batch file to
the project and configured the project to call it as a post-build event.
Then, I updated the batch file to copy files etc... as needed.

Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
 

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