How?
Add a valid global.json file to the root directory.
{}
Add two lines at the top of your vimrc file.
let g:OmniSharp_server_type = 'roslyn' let g:OmniSharp_prefer_global_sln = 1
Why?
These two OmniSharp settings OmniSharp omnisharp-vim to use Roslyn and use the directory containing the global.json file.
Here is the source code for OmniSharp.vim that uses these variables.
if g:OmniSharp_server_type ==# 'roslyn' && g:OmniSharp_prefer_global_sln let global_solution_files = s:globpath(dir, 'global.json') call filter(global_solution_files, 'filereadable(v:val)') if !empty(global_solution_files) let solution_files = [dir] break endif endif
If this does not work ...
Try starting OmniSharp manually from the command line:
omnisharp-vim\omnisharp-roslyn\artifacts\scripts\OmniSharp.cmd -s C:\temp\
The C:\temp\ directory contains the new .NET Core project with a valid global.json file.
Shaun luttin
source share