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 creating an MSBuild task that will generate one or more files, I
I have written an MSBuild task that makes use of third-party assemblies. When I
From this article I see I can use msbuild to apply configuration transformations but
How can I get MSBuild to evaluate and print in a <Message /> task
In msbuild/xbuild I'd like to have a libPath property which can be ovveridden on
I have a custom MSBuild task that peeks inside an assembly to get some
I have a batch script that I want to call from an MSBuild project,
In an MSBuild task, you can set the overall verbosity, but what I'd really
I am trying to use the WriteCodeFragment MSBuild task to create an AssemblyVersion attribute.
There is Copy to Output Directory property for files in C# projects. But in

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.