Automatically copying a file to compile directory?

  • Thread starter Thread starter Jacob
  • Start date Start date
J

Jacob

Really more of a VS.NET question than a C# question.... I have a couple
files in my solution that I would like copied to the compile directory when
the solution is built. How do I set it up so that everytime I build the
solution these files will automatically be copied into the same directory?


Thanks,
Jacob
 
In the post build event add a batch command. You can set the post build
event from project properties->Common properties->Build Events.
 
Use the menu Project - Properties

Click on Build Events

In Post-build Event Command Line put your copy statements, such as:
copy "$(ProjectDir)XML Files\config.xml" "$(TargetDir)"

Set the Run the Post-build Event? to suit your needs.

In my example the $(ProjectDir) will start the path of the file to
copy at the project root, and the $(TargetDir) will put in the same
directory as the build which will change automatically when you do a
Debug or Release build.

If you click on Help on the Project Properties Pages dialog, it will
bring up a list of available macros you can use in addition to these
2.

Bob
 
Thanks, I knew it was something simple.

Jacob


S. Han said:
In the post build event add a batch command. You can set the post build
event from project properties->Common properties->Build Events.
 
Back
Top