Build Script?

G

Guest

Hello, Newsgroupians:

In Visual Studio 2005, I have a project that I continually build and run
over and over. However, it also has external dependencies, which are three
other files in another directory on my computer. Is it possible to tell
Visual Studio to go grab these files before you begin running and place them
in the run directory, so I can make my code system independent [IE: Instead
of specifying the entire path for the file, I can just do @".\<filename>"]?

I change the three other files continually, and I'm not in the mood to open
Windows Explorer and copy and paste the files in the bin\Debug or
bin\Release. I would hard code the directory in the code, but I'm trying to
get away from it being system dependent. Thank you.


Trecius
 
R

Rene

1) Add the file to the project.

2) Right click on the file.

3) Under "Copy To Output Directory" select the option that best fit you such
as "Copy if newer".
 
R

Rene

I am such an idiot :)

Never mind my previous post.

You may however look under the project properties and the "Build Events" tab
(Pre-build event command line), there you may be able to call a little
program that does what you need. Alternatively, you may just want to add the
code on your startup function to do what you need to do .
 
G

Guest

Trecius said:
Hello, Newsgroupians:

In Visual Studio 2005, I have a project that I continually build and run
over and over. However, it also has external dependencies, which are three
other files in another directory on my computer. Is it possible to tell
Visual Studio to go grab these files before you begin running and place them
in the run directory

I guess you want to create a pre-buuild script.. I don't have VS at hand
but you can define a command or a list of commands that will be executed
just before or after compilation. Just write a .bat file that copies
your files too the desired destination. There are some environment
variables too that you can use.

Another solution is to define the "copy local" property for the
reference files; set them to true. The files should be copied
automatically to your executable.

HTH,

Sebastian
 

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