简体   繁体   中英

Strange nodes in Visual Studio Solution Explorer project tree. How do I get rid of them.?

I have a large solution with many .NET 6.0, C# projects. One of them (a Prism module, one of 11) has a couple of odd tree nodes that appear in Solution Explorer. I cannot get rid of them nor figure out why they are there. One corresponds to a disk folder, one does not. They are circled in red below

在此处输入图像描述

The obj tree node obviously corresponds to an actual folder on disk. But the same "obj" folder lives underneath most of the projects, yet only shows up for this one module.

I've tried a few things to get rid of it

  • I cannot delete the folder in the solution explorer.
  • When I delete the folder on disk, the node disappears for a second but then the folder gets recreated automatically and it reappears.
  • When I right click on the folder it in the Solution explorer, the only Git option I get for it is to add it to source control which is the opposite of what I want不是我想要的
  • I have verified that it the folder does not exist in my Git repo so I didn't accidentally check it in.

The Imports tree node makes even less sense There's no folder for it on disk. It seems to refer to items in .NET that my app is using.

I cannot find any entry in the solution's.gitignore file that refers to either "Imports" or "obj" by name (except a line excluding "*.obj"). I see nothing in the raw project file -- which is identical to many others that would explain this any of this. I have gone through it line by line comparing to others.

I am using VS 2022 but I know I saw this with VS2019 as well

Any ideas how to make these things go away...?

Toggle the "Show all files" button.

在 Visual Studio 解决方案资源管理器中显示所有文件按钮

The button applies to each project separately, so that would explain why you see "obj" folders in some places and not others. For those projects that have "show all files" toggled on, you'll see the files and folders that live under a project on your hard drive but that are not actually part of the project. For those project that have "show all files" toggled off, you won't see such files in the Explorer.

Unfortunately I do not know anything about Prism, but I imagine the same sort of thing is happening for the Imports. Or Imports could be more like References in a C# project and they will just always show.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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