O'Reilly logo

Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build by William Bartholomew, Sayed Ibrahim Hashimi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Copy Task

A very common scenario for builds is copying a set of files from one place to another. How can we achieve this with MSBuild? There are several ways we will demonstrate in this chapter. Before we discuss how to copy the files, we’ll first take a close look at the Include statement of an item. I have created some sample files shown in the following tree, which we will use for the remainder of the chapter.

C:\Data\MSBuildExamples\Fundamentals
|
| ...
|
+---src
   |  one.txt
   |  two.txt
   |  three.txt
   |  four
   |
   +---sub
         sub_one.txt
         sub_two.txt
         sub_three.txt
         sub_four.txt

Previously, I said that three types of values can be contained in the Include declaration of an item. Those three are:

  1. A single value

  2. Multiple values separated by a ";"

  3. Declared using wildcards ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required