.net 当我单击解决方案资源管理器刷新按钮时,为什么 Visual Studio 不刷新文件夹?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/472316/
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-09-03 11:04:22  来源:igfitidea点击:

Why doesn't Visual Studio refresh the folders when I click the Solution Explorer refresh button?

.netvisual-studiosolution-explorer

提问by Edward Tanguay

In Visual Studio 2008, I can see all my project files in my Solution Explorer, and these files exist in an actual diectory.

在 Visual Studio 2008 中,我可以在我的解决方案资源管理器中看到我所有的项目文件,并且这些文件存在于实际目录中。

However, if I add a file to that directory (let's say, an test.sqlite file in the App_Data folder, or say, images created by some other program), then these files do NOT appear in my Solution explorer, even if I click the refresh button.

但是,如果我将一个文件添加到该目录(比如 App_Data 文件夹中的 test.sqlite 文件,或者说,由其他程序创建的图像),那么这些文件不会出现在我的解决方案资源管理器中,即使我单击刷新按钮。

How can I make files created by other applications appear in my Solution Explorer?

如何让其他应用程序创建的文件出现在我的解决方案资源管理器中?

(so far, I have to create them somewhere else, then copy and paste them into the solution explorer itself, but there must be an easier way).

(到目前为止,我必须在其他地方创建它们,然后将它们复制并粘贴到解决方案资源管理器本身中,但必须有更简单的方法)。



Edit:

编辑:

Is there an advantage to this "fake solution view", i.e. I could have a file "test.sqlite" in my App_Data directory but in my solution, it could be appearing in my root directory. Coming from an Eclipse WYSIWYG Solution Explorer mindset, I don't see the advantage of having this extra virtual meta-information about the actual files in your directory. Is there a way you get an advantage out of this metaphor?

这种“假解决方案视图”是否有优势,即我可以在我的 App_Data 目录中有一个文件“test.sqlite”,但在我的解决方案中,它可能出现在我的根目录中。来自 Eclipse WYSIWYG 解决方案资源管理器的思维模式,我没有看到在您的目录中拥有有关实际文件的额外虚拟元信息的优势。有没有办法从这个比喻中获得优势?

回答by GeekyMonkey

At the top of the solution explorer is a toggle button "Show All Files" this makes it include all files in the display even if they aren't included in the project. The icons for these will be grayed out a bit. Then just use the context menu to add these to the project.

在解决方案资源管理器的顶部是一个切换按钮“显示所有文件”,这使得它包括显示中的所有文件,即使它们没有包含在项目中。这些图标将变灰一点。然后只需使用上下文菜单将这些添加到项目中。

回答by Gerrie Schenck

On the solution, click the right mouse button and select 'Add existing item' and pick the file from the solution root directory. The Solution will now get a 'Solution Items' directory which contains your file. This directory is virtual, so it does not exist on disk.

在解决方案上,单击鼠标右键并选择“添加现有项目”并从解决方案根目录中选择文件。解决方案现在将获得一个包含您的文件的“解决方案项目”目录。此目录是虚拟的,因此它不存在于磁盘上。

However there is no feature like 'Show All Files' for a solution, this only works on projects.

但是,解决方案没有像“显示所有文件”这样的功能,这只适用于项目。

回答by S S

I faced the same issue. I added new files and folders but the next time I took latest source code from SVN and then opened the project, it wont show the files which were added.

我遇到了同样的问题。我添加了新的文件和文件夹,但是下次我从 SVN 获取最新的源代码然后打开项目时,它不会显示添加的文件。

You can perform the following steps : 1. Solution explorer -> Show all files 2. Those files which are added recently will be displayed without the [@] icon on left side. Right click on the file and Select Include in the project 3. If you see the config file Web (Visual C# Project file (.csproj)) under Web folder, you will see the entries made for these new files. Check in this config file in your svn. 4. The next time you take repo checkout , it wont be an issue as the file details have been added into the configuration.

您可以执行以下步骤: 1. 解决方案资源管理器 -> 显示所有文件 2. 那些最近添加的文件将在左侧不显示 [@] 图标。右键单击该文件并选择包含在项目中 3. 如果您在 Web 文件夹下看到配置文件 Web(Visual C# 项目文件 (.csproj)),您将看到为这些新文件创建的条目。在您的 svn 中签入此配置文件。4. 下次进行 repo checkout 时,不会有问题,因为文件详细信息已添加到配置中。

Hope this helps.

希望这可以帮助。