bas
bas

Reputation: 14982

msbuild PostBuildEvents copy if newer

Is it possible to define copy events in PostBuildEvents section which only copies the file if the file is newer?

<PostBuildEvent>
    xcopy "$(TargetDir)afile.extension" "$(TargetDir)..\afile.extension" <!-- anything possible which only copies if newer? -->
</PostBuildEvent>

Upvotes: 0

Views: 684

Answers (1)

Ron Barrett
Ron Barrett

Reputation: 36

Xcopy has a switch for doing just that. /D:m-d-y If you provide a date it will copy only files that were created after that date. If you don't provide a date it will copy only those files on the source that are newer than those in the target. You might want look at Robocopy,as it has many more options than xcopy.

Upvotes: 2

Related Questions