简体   繁体   English

为什么不只在输出目录中的文件较旧时才用“更新时替换”进行复制?

[英]Why Copy if newer replaces not only when a file in the output dir is older?

I discovered this issue when I added an Access DB file to my project and set it to Copy if newer: 当我将Access DB文件添加到项目并将其设置为Copy(如果较新)时,我发现了此问题: 在此处输入图片说明

I thought it would be copied to the output directory only if a file in the output directory is older than the file in the project directory. 我认为只有在输出目录中的文件比项目目录中的文件旧时,它才会被复制到输出目录。

In fact it is copied even if the file in the output directory is newer: for example when I edited and saved it by my program. 实际上,即使输出目录中的文件是较新的,它也会被复制:例如,当我由程序编辑并保存它时。

Also I tested it in another project using another kind of file (.txt). 我也在另一个项目中使用另一种文件(.txt)对其进行了测试。

MSDN says MSDN

Select Copy if newer if the file is to be copied only when it is newer than an existing file of the same name in the output directory. 如果仅在文件比输出目录中同名的现有文件新时才复制文件,请选择“如果新则复制”。

Is it a bug or am I doing something wrong? 是错误还是我做错了什么?

As it turned out you were rebuilding your project. 事实证明,您正在重建项目。 Rebuild is essentially just a clean followed by a build. 重建本质上只是一个干净的构建。 This means your file got deleted, and as part of the regular build it got copied over (since there is no newer version). 这意味着您的文件已被删除,并且作为常规构建的一部分已被复制(因为没有较新的版本)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM