Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 219811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:52:47+00:00 2026-05-11T18:52:47+00:00

In MSBuild I can use the Copy task to copy files from one location

  • 0

In MSBuild I can use the Copy task to copy files from one location to another.

I can also use the SkipUnchangedFiles property to specify that files should not be copied if they have not changed.

Is there a standard pattern for predicating a follow-up action on the condition that one or more files were copied?

For example:

  1. Copy any updated deployment scripts
  2. Execute the batch file which runs all the deployment scripts, in the correct order, if and only if one or more of the scripts have changed

One further complication is that I am using the CreateItem task to dynamically generate the list of input files:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CopyAndRun">
  <Target Name="CopyAndRun">
    <CreateItem Include="In\**\*Test*.txt">
      <Output TaskParameter="Include" ItemName="SourceFiles"/>
    </CreateItem>
    <Copy SourceFiles="%(SourceFiles.Identity)" DestinationFolder="Out\%(RecursiveDir)" SkipUnchangedFiles="true" />
    <!-- Only want to execute this if updated files were copied -->
    <Message Text="Running..." />
  </Target>
</Project>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:52:48+00:00Added an answer on May 11, 2026 at 6:52 pm

    You can achieve this with incremental building that is provided out of the box with MSBuild.

    Sayed Ibrahim Hashimi

    My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to learn how to use MSBuild so we can use it
How can I construct a MSBuild ItemGroup to exclude .svn directories and all files
How can I programatically get the path to MSBuild from a machine where my
I have an MSBuild task that executes (among other things) a call to xcopy.
We use ajaxmin to create .min.js files from all our .js files. We have
I can build the whole project by calling MSBuild from the command line: C:\MyProject>MSBuild
I am trying to use the WriteCodeFragment MSBuild task to create an AssemblyVersion attribute.
Can anyone explain what advantages there are to using a tool like MSBuild (or
I am using MSBuild to build my stuff. I want to use CruiseControl.net as
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.