Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to specify includes in omnisharp.json #2213

haacked opened this issue Aug 26, 2021 · 0 comments

Add ability to specify includes in omnisharp.json #2213

haacked opened this issue Aug 26, 2021 · 0 comments


Copy link

haacked commented Aug 26, 2021

This is a follow-up from #1372 (comment)

The proposed change is to add an includes field in omnisharp.json that includes an array of one or more script files that would be loaded at the beginning of .csx files in the scope of the config. (To be honest, it could be a single script file since that file could # load all the files it wants. Doesn't really matter to me.).

  "script": {
     "enabled": true,
     "defaultTargetFramework": "net461",
     "enableScriptNuGetReferences": false,
     "includes": ["globals.csx"]

Obviously, the included scripts themselves would be unaffected by this setting otherwise you get a recursive infinite inclusion and we're not trying to live in the world of Inception.

One thought, to prevent confusion, is to require that includes have a different extension .include. That way, if you remove a script from this setting, it doesn't suddenly start being affected by it.


We're in the situation where we have a custom C# script host ( Our script host supplies a Bot instance to scripts via a GlobalType. Unfortunately, this GlobalType cannot be supplied to Omnisharp for reasons that @filipw mentions in this comment.

Ideally we would be able to pass a script globals type via .rsp file, but that's not possible today (there's an issue tracking it).

Another option would be to use an OmniSharp plugin, but they don't support scripting (I'll log an issue for that after this).

A nice workaround was proposed in this comment by @germanftorres. Just create an instance of Bot in a globals.csx file and load that file into the script that's being edited. However, that would require that my script files all have # load "globals.csx" file at the top, which the Abbot Script Host knows nothing about.

This setting would allow me to provide full Intellisense to Abbot scripts without having to modify the script file. Thanks for your consideration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants