标记为内容的文件 ->Copy Always 没有被复制 [英] File marked as Content -> Copy Always is not being copied

查看:28
本文介绍了标记为内容的文件 ->Copy Always 没有被复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 C# VS2010 项目文件夹中有一个文件,标记为 ContentAlways Copy.

I have a file in a folder of my C# VS2010 project marked Content and Always Copy.

当我更改此文件并保存,外部到VS,然后运行项目时,修改后的文件不会复制到输出.如果我重建,那就是.我的猜测是VS并没有使用文件的修改日期时间戳来判断是否应该复制.

When I change this file and save it, externally to VS, and then run the project, the modified file is not copied to the output. If I rebuild, then it is. My guess is that VS does not use the modified date time stamp of the file to determine whether it should be copied or not.

我错过了什么吗?每次跑步都要浪费 5 分钟,这让我很抓狂.

Am I missing something? It's driving me nuts as I'm losing 5 minutes per run.

谢谢!

推荐答案

难以解释,所以从获得更好的诊断开始.工具 + 选项、项目和解决方案、构建和运行设置.将MSBuild 项目构建输出详细程度"设置更改为正常".在同一属性页中,确保运行时,项目过期时"设置设置为始终构建.当您按 F5 或 Build + Build 时查看输出窗口,_CopyOutOfDateSourceItemsToOutputDirectory 任务是复制文件的任务.

Hard to explain so start by getting better diagnostics. Tools + Options, Projects and Solutions, Build and Run settings. Change the "MSBuild project build output verbosity" setting to Normal. In that same property page, ensure that the "On Run, when projects are out of date" setting is set to Always build. Look in the Output window when you press F5 or Build + Build, the _CopyOutOfDateSourceItemsToOutputDirectory task is the one that copies the file.

使用 Project + Add Existing Item 时的一个可能陷阱:IDE 会复制您选择的文件.您可能正在更改原始文件而不是项目目录中的副本.您可以通过单击对话框中添加"按钮上的箭头并选择添加为链接"来解决此问题.

One possible trap when you use Project + Add Existing Item: the IDE makes a copy of the file that you selected. You might be changing the original file instead of the copy in the project directory. You'd fix that by clicking the arrow on the Add button in the dialog and selecting "Add As Link".

这篇关于标记为内容的文件 ->Copy Always 没有被复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆