make an MSBuild Copy Task only copy if the source is newer regardless of size

后端 未结 2 1989
醉酒成梦
醉酒成梦 2021-02-05 17:45

I\'m currently using an msbuild file to copy some files to the public documents folder when my EXE is compiled. My current script includes this:



        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-05 18:05

    Your copy's conditional can be changed as follows:

        
    

    %(ModifiedTime) = Modified Datetime of the source file

    $([System.IO.File]::GetLastWriteTime($(PublicDocumentsFolder)%(Path)\%(RecursiveDir)%(Filename)%(DeploymentItems.Extension))) = Modified Datetime of the destination file, if it exists

    Let me know if this works or not, did not test.

提交回复
热议问题