vscode-csharp: OmniSharp does not respect `files.exclude`
Environment data
dotnet --info
output:
.NET Command Line Tools (2.0.0-preview2-006497)
Product Information:
Version: 2.0.0-preview2-006497
Commit SHA-1 hash: 06a2093335
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0-preview2-006497\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0-preview2-25407-01
Build : 40c565230930ead58a50719c0ec799df77bddee9
VS Code version: Code 1.14.2 (cb82febafda0c8c199b9201ad274e25d9a76874e, 2017-07-19T23:34:09.706Z) C# Extension version: csharp|ms-|1.11.0
Steps to reproduce
Open VSCode on a directory that has projects (mine are in subfolders) that are excluded by files.exclude
(I’m doing it from .vscode/settings.json
).
Expected behavior
OmniSharp does not try to process projects within excluded folders.
Actual behavior
OmniSharp tries to process projects within excluded folders.
Other Details
I’m transitioning a large project (50+ libraries, 5+ apps) from MSBuild (Visual Studio) to dotnet (VSCode). I have configured VSCode to ignore all the projects that have not been transitioned yet. OmniSharp is trying to process the un-transitioned projects.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 50
- Comments: 26 (4 by maintainers)
Is there any progress so far with this? Currently this issue renders VS Code useless for me, since the whole IntelliSense is broken down, because of one subproject. Quite frustrating.
Having the same problems as @sequitur. In the settings.json the “obj” and “bin” directories are in the “files.exclude” section. However the generated AssemblyInfo.cs files are still analysed. This results in warnings like "Unnecessary using directive.'.
I have “**/artifacts” in
files.exclude
, and have setgenerated_code = true
for[artifacts/**.cs]
in my.editorconfig
, but OmniSharp still reports errors fromartifacts/obj/**.cs
.I see #2171 has been merged in, yet I’m still facing the same issue: OmniSharp is trying to load a .Net Framework project for which I’ve explicitly excluded the .csproj of.
Leaving a comment in case anyone ends up here from Google (this is the top result when I search ‘vscode c# ignore folder’:
I managed to get the analyzers to ignore folders/files thru using
.editorconfig
(might need to enable it in vscode c# settings): Microsoft Docs reference for analyzersTelling omnisharp that it’s generated code seems to keep it from analyzing.
(Unfortunately in my case the folder I wanna exclude is an outside library source which I wanna ignore; unfortunately they have their own
.editorconfig
withroot = true
and mine’s getting overridden. That’s another problem though.)I have this same issue. Are there any news on this?
@ghandmann This is being worked on in https://github.com/OmniSharp/omnisharp-vscode/pull/2171
I can confirm as well that
.editorconfig
file as suggested doesn’t work for me in vscode, errors are still reported.Edit: My bad, turns out I just needed to enable
"omnisharp.enableEditorConfigSupport": true
in vscodesettings.json
, errors are not reported anymore.For reference, here is my
.editorconfig
contents:Any updates on this. I am working on a WPF project and OmniSharp is currently telling all my classes have already be implemented as it is scanning the
obj
folder.Clearly I don’t understand as well as I thought I did. I apologize.
Is it out of the question to have an override in OmniSharp that at least ignores errors in specified files/folders? Does that functionality exist already?
When I use external libraries I get hundreds of messages about stuff like naming conventions, ‘can be readonly’, etc. Certain VSCode extensions (like Local History) break OmniSharp entirely if they place files within the workspace.
I’m not sure how manually editing solution/project files would affect the build process, but either way I feel like it shouldn’t be necessary.