What does 'Exclude' do? (Right click menu on folder)


I was getting some erroneous errors reported in 3rd party code, so I right-clicked the folder containing it and chose 'Exclude', and the errors went away. Great!

Except, why did they go away? I had hoped I had just excluded the code from inspections, but it turns out there is a dialog for that specific purpose in the Settings (Editor > Inspection Settings) and that doesn't contain the directory I excluded. So, it's not that.

A search in this forum suggested that people can see the previously excluded files using 'Show Hidden Files' in the Explorer - but that's wrong too, because these files are not hidden. They're just excluded - with no visible indicator that they're excluded, nor any way to re-include them.

Another post in this forum said "clicking exclude adds those files to csproj" and I don't see any evidence of that either.

So can someone explain what this feature actually does?


Hello, Ben! 

Sorry for the late answer.

When you exclude files or folders from a project, they are just not analyzing. Files became "non-solution". 

In Editor > Inspection Settings you can specify files or folders that should be excluded automatically. 

Excluded files are marked by colour in Solution Explorer (depends on your colour scheme) and should not be visible if "Show all files" if off. 


Could you please tell me, what Rider version do you use? 


I'm using Rider 2019.1.1, Resharper Dark scheme.

Hidden files don't get a highlight when they're revealed via the 'Show Hidden Files' button, so that makes it very hard to work out what is hidden and what is not in a complex directory structure. I'd have to go into every directory and toggle the button to see what appears. Is there a more practical way to see the list? Maybe even just in a file somewhere?

I also don't see a direct relationship between hidden and excluded things - because there are many files that are hidden (and appear when I click 'Show Hidden Files') but the Exclude menu item only appears for directories - not files. I can't exclude files this way. And it doesn't appear for all directories - some I can't Exclude, and there's no clear reason why.

And there are obviously hidden files that are not in the list of files excluded from inspection - e.g. .meta files in my Unity project - because obviously they don't need inspecting. But I don't see where this setting is, or how it could be affecting things.

So, unfortunately I still don't really know what this 'Exclude' menu option does. Can we please have a clear document somewhere?


So, does nobody at JetBrains know what this option actually does?



We've investigated your cases. Unfortunately, it's by design for now.

For now, you can't stop indexing or include/exclude generated files. The reason is that the files are recreated and it leads to indexing. The flow is going to be reworked in the scope of RIDER-23121. Sorry for inconveniences. Also, all specific files that are necessary to build a project should be included in it, so some files you can't exclude them from the project, like *meta-files. Also, these files are auto-generated, so 

Hidden files are not highlighted in Unity mode of Solution Explorer. You can temporarily select Solution mode to observe files and upvote to RIDER-30037 issue.


Okay, I didn't really understand any of that - perhaps because this still doesn't answer the question of "What does Exclude do?"

Also I'm not interested in 'generated files'. I only mentioned meta files to prove that hidden files and excluded files are obviously not the same thing.

I want to know - "What does Exclude do?"


Basically, "Exclude" adds in *.cproj file file to "compile remove" group, like: 

<Compile Remove="Program.cs" />


Okay, so in my case it would temporarily hide the errors (until Unity regenerates those *.csproj files). I guess that might be what you were getting at with the generated files thing, but that's fine - I just wanted to know exactly what the option does.

For my inspection problem I can exclude them in the settings (although that UI could really do with improving... typing individual paths is not very friendly!)


Bumping this because 'Exclude' in Rider is still bad UI.

I accidentally excluded a directory from my current project by clicking slightly in the wrong place on the right click menu.

'Undo' doesn't undo this, and there seems to be nowhere in the settings where I would be able to go and reverse this problem. I didn't even know what I'd done until I right clicked again to bring up the menu and guessed at what I must have clicked. There isn't even a tooltip when you hover over 'Exclude'.

I had to Google for "rider exclude" to find out what had happened, and the only answer is this, my own thread from 3 years ago. And I can't see what's changed in the .csproj file, but there is no instance of "compile remove" as stated above.

Please, fix this UI/UX disaster and either remove this option or place it behind a confirmation prompt that explains what it actually does. Luckily I am working with Unity and it regenerated the csproj files for me, but others might not be so lucky or could waste hours trying to understand the issue.


Hello Ben,

Don't you use the Unity view mode in the Explorer view? Exclude action is not available in this mode.
For the Solution view mode: 

When you exclude file/folder and Show All Files is disabled in Solution Explorer, it is expected that the object you excluded disappears from Solution Explorer. You can find the excluded object by enabling Show All Files in Solution Explorer.

As an available option, you can move the Exclude action out of the context menu and place it, for example, under `Edit` sub-menu or delete this action from the list of context actions. Please check the screenshot attached.

Have a nice day!


Don't you use the Unity view mode in the Explorer view? Exclude action is not available in this mode.

This is wrong. It's there as usual:

You can find the excluded object by enabling Show All Files in Solution Explorer.

This doesn't really work either. A Unity solution often has many projects which all reference the same part of the filesystem, each with different excluded files. I'd have to look through each individual project, and be very familiar with each one to spot what was wrongly excluded.

I also notice that even once you find out what's been excluded, there's still no practical way to undo or fix this. Maybe there's some setting deep within project properties but there are many settings there and it's not easy to find.


Hello Ben,

Apologies for the confusion. The `Exclude/Include` context actions should not be available in `Unity` mode of `Explorer`. There was a bug, which is already fixed. The fix is available starting from Rider 2022.3 EAP 1. Feel free to give it a try.

Also, you might be interested in this issue on our tracker. Feel free to upvote and leave a comment to demonstrate the additional interest.

Have a nice day!


Please sign in to leave a comment.