Visual Studio dotted folder - visual-studio-2010

In the Visual Studio (2010) Solution Explorer, what do the dotted "ghost" folders mean? I can still open them up and open contents within them, so how do they differ from the rest of the normal yellow folders? My reason for asking is that currently my project is missing a file that it expects to be in one of the dotted folders, so I was hoping that some insight into exactly what they mean would be helpful.
Thanks!

Also this can refer to a file/folder that is not included in the project. This can be included by right clicking and selecting 'Include In Project'.

It means it is showing you a file or folder that typically would be hidden by Visual Studio. For example, the bin folder isn't something you typically interface with directly - when you build in VS, it adds the files into the bin folder. So, you don't really need to have access to it as it doesn't contain any editable files. However, it does still exist within the directory.

Related

Organizing project files in Visual Studio for better explorer view

I have a project in visual studio where there are several files arranged in folders (filters). Inside the project, everything is well organized, but as soon as I go to the explorer, I see that all the project files are in the same folder. How can I properly organize my project so that the repository doesn't look like a bunch of files in one folder?
I use Visual Studio 2022
I tried to manually decompose the files into folders, but when I did this, visual studio began to swear that it could not find the files
Can you share a screenshot of what you have and what you want?
I ask because there are two aspects to this.
The arrangement of projects within Solution Explorer
The arrangement of files within projects within Solution Explorer
The first can be controlled by adding solution folders. The structure is stored within the .sln file.
The second is generally a representation of the file system, depending upon your project type.
Also, make sure you're using the Solution Explorer view. Does this button appear clicked for you?
If so, you should unclick it. Solution Explorer can show you either the solution view (default, and what I refer to above) or the file system view.

How to set up folder structure in Visual Studio

I am working on a project and I can see lots of folders which are dimmed and have dotted outline. I can expand them and each usually contains several projects inside. These are not hidden folders. Also, when I try to open projects into windows explorer, it opens up in a differently named folder than what it appears in Visual Studio.
I want to know what is it and how can this be done?
They are called Solution Folders and they are not bound to the folder structure on the disk. If you open your solution file with a text editor, you can see how they reference the projects.

VS 2010: Add as Link a complete directory of XML to a solution Folder? (no project exists at this level)

I need to add (as link) a complete directory structure that lives under my solution folder but not under any project folder.
Is this possible, i can't seem to find it.
I suppose 1 option is to add a new project type and then add these files under that project..
But it seems not a good way, what type of project type do i add, a c# class project? The files i wish to include are standard XML files and nothing to do with C#
Any ideas or i get around this?
This is possible in Visual Studio 2010 Professional and above. You can add a solution folder and then include files within that folder. Just right click the solution in the Solution Explorer and choose Add|New Solution Folder. Once the folder is added, right-click it and select Add|Existing Item... to add each of the files that you want to access from that folder.
Solution folders are symbolic (i.e. they don't have to map to a single physical location) so you can store shortcuts to files from many different file system locations under the same solution folder.

How can I tell Visual Studio to exclude folders from the Find in Files?

We use subversion so we have subfolders named _svn in our solution. Doing a Find in Files returns strings from these subfolders.
Is there any way to tell Visual Studio to ignore these files?
From "Find in Files", in "File Types" or "Look at these file types", you can use:
!*\ExcludeFolder\*
Example:
!*\bin\*;!*\obj\*;!*\.*;!*\ExcludeFolder\*
What you can do is to setup a set of folders that will be used for searching. In Find and Replace window, on the right hand side of "Look In" input you have a "Choose Search Folders" option where you can setup those sets of folders.
Just remember to turn off "Include sub folders" options if you have added root project folder.
If you don't have hundreds of folders this solution should work.
Never had an issue with the global find until we moved to Visual Studio 2017 and started with Angular + .net Core applications... (mostly problems with the HUGE node_modules folder being searched)
I found that using the MSBuild exclusion property DefaultItemExcludes is working fine to exclude from global find in Visual studio 2017..
I now by default open up the project file (.csproj) for a new core project in VS2017 and adjust the property as follows to exclude the node_modules (sometimes I add the wwwroot too):
<DefaultItemExcludes>$(DefaultItemExcludes);node_modules\**</DefaultItemExcludes>
See also
https://github.com/dotnet/cli/issues/7525 , there they advise to prepend the folders to exclude and seem to use a forward slash instead of backward slash, like this :
<PropertyGroup>
<DefaultItemExcludes>node_modules/**;$(DefaultItemExcludes)</DefaultItemExcludes>
</PropertyGroup>
Hope this helps anyone experiencing issues with VS2017 global find / search .
I had this problem when moving to Windows 10 using Visual Studio 2015 and TortoiseSVN. Previously the .svn folders were all hidden so did not appear in search results. To solve this I simply went to the folder properties in Windows Explorer and checked the 'Hidden' attribute for the .svn folder. After refreshing the folder view in Visual Studio the .svn folder no longer appeared and is ignored when using Find!
Instead of searching for files in a directory (your solution's directory, in this case), you could limit your search to the files that are part of the project or the solution. Those in the _svn directories will thus be ignored.
I found in Visual Studio 2017 especially when using Angular Cli that the generated javascript files or other build files can be added to your project sometimes unknowingly. This can cause several headaches including adding a bunch of files to the searches and really slowing things down, especially intellisense because it is searching all of the generated files on top of the source files.
The easiest way I have found to correct this is to simply right click on the build folder (i.e. {Project}/dist) and select Exclude from Project. This will remove the folder from the project but the generated contents will still be available for runtime, it is just hidden from the UI.
If you need to still see the files, you can show hidden directories and files by selecting Show all Files or
click on the Icon:
on the top of the Solution Explorer.
Basically you want to exclude all build folders from your project/solution.
I don't think you can set this (after all, you are asking for "Entire Solution" search), but often you can remove the folder from the project / hide the directory in filesystem (for Web Site project type).
If you are not using VS2019 or VS Code (for which the solution has already been found in other answers), as a workaround you can use the search in Far Manager, it supports masks to exclude certain files or folders from the search.

Common Files in Visual Studio Solution

Many times I have seen Visual Studio solutions which have multiple projects that share source files. These common source files are usually out in a common directory and in the solution explorer their icon shows up with a link arrow in the bottom left.
However, any time I try to add a source file to the project that is outside of that project's main directory, it just automatically copies it into the directory so that I no longer have a shared copy.
I found that I can get around this by manually opening the project file in a text editor and modifying the path to something like "../../../Common/Source.cs" but this is more of a hack then I would like.
Is there a setting or something I can change that will allow me to do this from within the IDE?
Right click on a project, select Add->Existing Item->Add as link (press on small arrow on Add button)
Thanks #aku!
I knew this could be done, but I didn't know how to do this from Visual Studio. It shows up as a shortcut to the file and the csproj file generates the resulting XML like this:
<Compile Include="..\CommonAssemblyInfo.cs">
<Link>CommonAssemblyInfo.cs</Link>
</Compile>
I've seen this technique commonly used for common AssemblyInfo files to keep a consistent version.

Resources