Search code examples
visual-studio-2008directorycopyxulrunnergeckofx

How to copy automatically needed files from any dir to release- or debug-directory in Visual Studio 8


I'm using Visual Studio 2008 and the imported GeckoFX-Framework in one of my projects. Since the Geckofx-13.0.dll uses the XUL-Runner itself, it's mandatory to have those files also in the build-directories of the project. Up to now I used to copy them manually into the two directories (Debug & Release).

I'm asking myself if I could tell VS to copy them automatically into those directories.

If those files are missing, the execution of the build fails.


Solution

  • You could add the required files to your project, set them as "Content" in the properties window and set the Build Action to "Copy if Newer".

    You could add a Post-Build action (right-click project, choose properties) to the release and debug configuration to copy the files to the output directory (you can use a macro instead of hard coding, that way the right destination is always used, also when it is edited in the project settings). A simple copy .\Files\*.* $(TargetDir) would probably work. Any command you can execute from the command line works here as well.

    The preferred way:

    You could add a Post-Build target (right-click project, unload project, rightclick unloaded project, edit project) and use the msbuild <copy> tasks to copy files from one location to another. You can again use a macro such as $(OutDir) or $(TargetDir) or $(Platform) and $(Configuration).