Take the 2-minute tour ×

I have a project set up in my visual studio solution that contains a number of linked files. These are content files.

When I build the project I would like to copy the linked files to another location. Is this possible and how can I achieve it?

share|improve this question
Are these 'linked files' to be copied to a location that is completely separate from the website? (I'm assuming from the asp.net question tag, you're building a website). –  KazR May 23 '12 at 9:51
yes correct. They are to be copied a separate location on the same file system. –  amateur May 23 '12 at 9:58
add comment

3 Answers

For anybody stumbling on this page like myself, further to 5arx' post, I implemented an MSBuild target that copies all linked content files to their "virtual" locations (the directory where you placed the link in Visual Studio): http://mattperdeck.com/post/Copying-linked-content-files-at-each-build-using-MSBuild.aspx

share|improve this answer
add comment

if you right click on the project, then choose the "Build Events" tab, you should be able to create a post build event script which will take any file you specify and copy it to the location you specify.

Good place to start would be here

share|improve this answer
Thanks for this but as the files are linked files, they dont exist within in the project on the file system. How could I handle this? –  amateur May 23 '12 at 11:24
You should still be able to target them using XCOPY - essentially, the post build commands are stored in a .bat file which the environment executes after you have built the project. If the files themselves aren't going to be moved and you can rely on absolute paths to them, use the absolute paths in the build events script and move them on out. –  inksmithy May 23 '12 at 12:52
add comment

You can do this with MSBuild. Specifically with its Copy Files task:

share|improve this answer
add comment

Your Answer


