visual-studio VS2008:禁用询问是否重新加载在 IDE 外更改的文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1139752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 10:46:48  来源:igfitidea点击:

VS2008: Disable asking whether to reload files changed outside the IDE

visual-studiovisual-studio-2008filereload

提问by Christian Klauser

I have a Visual Studio 2008 project where some code files are generated with each build (a parser, integrated via MSBuild aka editing the *.csproj file). VS does not know about the generated nature of these files (i.e. they are not the result of a "Custom Tool). So they "change" with every build, naturally. And VS2008 asks me after every buildif I would like to reload those files:

我有一个 Visual Studio 2008 项目,其中每次构建都会生成一些代码文件(一个解析器,通过 MSBuild 又名编辑 *.csproj 文件集成)。VS 不知道这些文件的生成性质(即它们不是“自定义工具”的结果)。所以它们自然会随着每次构建“改变”。并且 VS2008在每次构建后询问我是否要重新加载这些文件文件:

This file has been modified outside the source
Do you want to reload it?

此文件已在源外被修改
要重新加载吗?

That would be ok if I had one of those files opened and in front of me, but I get these modal dialogs even with none of the code files opened.

如果我打开了其中一个文件并在我面前,那就没问题了,但是即使没有打开任何代码文件,我也会收到这些模态对话框。

So my question is: Is there a way to disable this dialog, per project, per solution or globally?

所以我的问题是:有没有办法禁用这个对话框,每个项目,每个解决方案或全局?

Thanks!

谢谢!

回答by Tim Sylvester

For VS2008: Tools> Options> Documents> Detect when a file is changed outside the environment

对于 VS2008:Tools> Options> Documents>Detect when a file is changed outside the environment

For VS2010/2012/2013/2015: Tools> Options> Environment> Documents> Detect when a file is changed outside the environment

对于 VS2010/2012/2013/2015: Tools> Options> Environment> Documents>Detect when a file is changed outside the environment

回答by Brad

In Visual Studio Pro 2012

在 Visual Studio Pro 2012 中

There is an "Auto-Load changes, if saved" that works.

有一个“自动加载更改,如果保存”有效。

Tools > Options > Environment > Documents > Detect when a file is changed > Auto-Load changes, if saved

工具 > 选项 > 环境 > 文档 > 检测文件何时更改 > 自动加载更改(如果已保存)

回答by Drew Noakes

Because a picture paints a thousand words...

因为一张图画了一千个字...

enter image description here

在此处输入图片说明

回答by dan-gph

I generate source files on every build, and I don't (normally) get a "file has been modified" message if the file is not open in the editor.

我在每次构建时生成源文件,如果文件未在编辑器中打开,我(通常)不会收到“文件已被修改”消息。

I was getting it just now, however, on a closed file. (That's why I went searching for this question.)

然而,我刚刚在一个封闭的文件中得到它。(这就是我去寻找这个问题的原因。)

I think that's a bug. The file seems to get wedged sometimes. (But this is the first time it has happened in about a year.)

我认为这是一个错误。该文件似乎有时会被卡住。(但这是大约一年来第一次发生这种情况。)

I think I've found a work-around just now: Open the offending file and then close it again.

我想我刚刚找到了一个解决方法:打开有问题的文件,然后再次关闭它。

The point is, you shouldn't need to turn off changed file detection.

关键是,您不需要关闭更改的文件检测。