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
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).
OmniSharp does not try to process projects within excluded folders.
OmniSharp tries to process projects within excluded folders.
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.
Thanks for the request. This is a good feature request.
+1
Right now my "problems" panel on a C# project has well over 99 problems (no literally), all of them in vendor code, which renders the feature kind of useless. Is there a workaround or another configuration I can change to prevent this from happening?
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.'.
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.'.
One option is to set the csharp.suppressHiddenDiagnostics setting to true. This will keep diagnostics that are "hidden", such as remove unnecessary usings, from displaying in the editor and the problems pane. That means that remove unnecessary usings also won't squiggle in open files, but the light bulb will still be available to use.
I should mention that this particular feature request is about using files.exclude to help inform the projects that OmniSharp processes. It isn't about getting it to somehow ignore files in processed projects that might contain files that belong to the project. OmniSharp will always process files in "obj" because MSBuild will use it when processing the project. Ignoring files in "obj" could introduce errors in other files for certain project types.
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.
@ghandmann This is being worked on in https://github.com/OmniSharp/omnisharp-vscode/pull/2171
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.
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.
Agreed - very annoying.
same problem here using Local history extension that creates .history folder inside project root,need a way to exclude it.thanks
It looks like this can be done separately through an omnisharp.json file in the root of the workspace: https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options#file-options
I have no default omnisharp.json file in VsCode/user data,I've placed one in my project folder but not working :(
It looks like this can be done separately through an
omnisharp.jsonfile in the root of the workspace: https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options#file-options
Those settings don't do anything. I've tried all combinations of where to place the file and which settings to use.
it controls solutions/project file discovery, not individual cs files.
Can we get something that ignores individual .cs files then? Or rather, files of any type?
Or just get OmniSharp to respect files.exclude?
that is a csproj project file feature
https://stackoverflow.com/a/43219140
OmniSharp is only concerned with finding sln/csproj file to start with, after that MSBuild is responsible for processing everything
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.
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 analyzers
[Folder/**.cs]
generated_code = true
Telling 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 with root = true and mine's getting overridden. That's another problem though.)
I have "**/artifacts" in files.exclude, and have set generated_code = true for [artifacts/**.cs] in my .editorconfig, but OmniSharp still reports errors from artifacts/obj/**.cs.
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 vscode settings.json, errors are not reported anymore.
For reference, here is my .editorconfig contents:
[Assets/ProCamera2D/**.cs]
generated_code = true
[Assets/Tayx/**.cs]
generated_code = true
Most helpful comment
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.