简体   繁体   English

Visual Studio 2019 - 在解决方案资源管理器中查找不在源代码管理中的项目

[英]Visual Studio 2019 - Find items not in source control in Solution Explorer

Is there a way to filter the files in the Solution Explorer such that I only see items that are not included in source control ?有没有办法过滤解决方案资源管理器中的文件,这样我只能看到源代码管理中不包含的项目? I don't mean I want to see hidden files;我并不是说我想查看隐藏文件; I only want to see files that are included in the solution but are not a part of source control.我只想查看解决方案中包含属于源代码控制的文件。 You can usually tell these files because they are missing the little lock icon next to them, but I would like a way to filter to see only those files.您通常可以分辨出这些文件,因为它们缺少旁边的小锁图标,但我想要一种过滤方式以仅查看这些文件。

I ask because.我问因为。 . . . .

If I'm switching between projects or tasks, I like to create shelvesets to save any current progress, then right-click > Undo... to get rid of any pending changes.如果我在项目或任务之间切换,我喜欢创建搁置集以保存任何当前进度,然后右键单击 > Undo...以摆脱任何未决更改。 In .NET Framework projects, this both removes pending changes as well as excludes from the project any brand new files I may have created;在 .NET 框架项目中,这既删除了挂起的更改,又从项目中排除了我可能创建的任何全新文件; unfortunately in .NET Core, this removes pending changes, but any new files I may have created are still included in the project , even though they're excluded from source control.不幸的是,在 .NET Core 中,这会删除挂起的更改,但我可能创建的任何新文件仍包含在项目中,即使它们已从源代码控制中排除 This usually causes all sorts of build problems until I delete or exclude these files by hand, and I have to comb through my project folders to find them all (or build and rebuild and rebuild to see where the lingering errors occur).这通常会导致各种构建问题,直到我手动删除或排除这些文件,并且我必须梳理我的项目文件夹以找到它们(或构建并重新构建并重新构建以查看挥之不去的错误发生的位置)。 This is a PITA, so I am hopeful there's some easy way to do what I want.这是一个 PITA,所以我希望有一些简单的方法可以做我想做的事。

I am afraid there is no such out of way to achieve this with Solution Explorer directly.恐怕没有办法直接使用解决方案资源管理器来实现这一点。

I would like provide you a workaround based on the source control type, git or TFVC.我想为您提供基于源代码控制类型 git 或 TFVC 的解决方法。

If you are using TFVC, you could try to use the Source Control Explorer (View->Other windows -> Source Control Explorer) in VS, which has a button on its toolbar to compare folders.如果您使用的是 TFVC,您可以尝试在 VS 中使用 Source Control Explorer (View->Other windows -> Source Control Explorer),它的工具栏上有一个按钮来比较文件夹。 This allows you to compare the folder in source control with the folder on disk, including files that exist only on either side, or files with differences.这允许您将源代码管理中的文件夹与磁盘上的文件夹进行比较,包括仅存在于任一侧的文件或存在差异的文件。

If you are using the git, you could use the git command line git status to get those untracked files.如果您使用的是 git,您可以使用 git 命令行 git 状态来获取那些未跟踪的文件。 You could check this thread for some more details: How to tell if a file is git tracked (by shell exit code)?您可以查看此线程以获取更多详细信息: 如何判断文件是否被 git 跟踪(通过 shell 退出代码)?

暂无
暂无

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

相关问题 Visual Studio:有没有办法折叠解决方案资源管理器的所有项目? - Visual Studio: Is there a way to collapse all items of Solution Explorer? Visual Studio 2010问题-解决方案和源代码管理资源管理器不匹配-将项目添加到子文件夹仍然映射到根目录 - Visual Studio 2010 Issue - Solution & Source Control explorer mismatch - Adding projects to sub-folder still maps to root Visual Studio 解决方案资源管理器未在解决方案中显示项目 - Visual Studio Solution Explorer not showing projects in solution 无法在 Visual Studio 2019 中打开 WPF 解决方案 - Unable to open WPF solution in Visual studio 2019 在 Visual Studio 解决方案资源管理器中禁用区分大小写 - disable case sensitive in visual studio solution explorer Visual Studio 2017-当我“向源代码管理中添加解决方案”时如何禁用自动提交 - Visual Studio 2017 - How to Disable Auto Commit When I “Add Solution to Source Control” 无法使用 Visual Studio 2019 Server Explorer 连接到 MYSQL - Unable to connect to MYSQL using Visual Studio 2019 Server Explorer 在 Visual Studio 2019 中找不到“开始操作” - Can not find "Start Action" in Visual Studio 2019 解决方案资源管理器Visual Studio 2013中项目旁边的图标的含义是什么 - what is the meaning of the icons beside the project in Solution Explorer Visual Studio 2013 Visual Studio 2008:添加的项目未显示在解决方案资源管理器中 - Visual Studio 2008: Added Project not showing up in Solution Explorer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM