Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Omnisharp sublime text errors with ASP.NET 5.0 MVC6

I'm using the new asp.net mvc via github here: https://github.com/aspnet/home and I installed the Omnisharp package for Sublime Text 3 to get C# autocomplete. I am attempting to run the HelloMvc project, which works fine when I run k kestrel and then open http://localhost:5004/

However, a bit of annoyance is when I save a file (for example, HomeController.cs) and then Sublime Text console opens and gives me the following errors:

Error : Unknown Resolver Error - (1, 23)
Error : '?' does not contain a definition for 'Mvc' - (1, 27)
Error : 'Controller' is not a known identifier - (6, 45)
Error : 'IActionResult' is not a known identifier - (8, 29)
Error : 'View' is not a known identifier - (10, 24)
Error : 'HomeController' does not contain a definition for 'View' - (10, 32)

And then it give me swigglies under the matching lines. I would like whatever the feature is that is ensuring it is good code, however, is there a way to change the settings so that it recognizes this is all valid?

Or does Omnisharp not yet support the new way asp.net 5.0 handles external packages?

like image 218
girlcode Avatar asked Jan 18 '15 19:01

girlcode


People also ask

Can Sublime Text and omnisharp use mono and MSBuild?

Sublime Text and Omnisharp must have access to both Mono and MSBuild. I tried using mono --version and msbuild --version in Windows Terminal (using Powershell), yet none of them worked (even if I have BOTH of them installed, most likely they still aren't in PATH, will test again if I regained my sanity).

How to add a solution file to a sublime project?

Clone repository. Move to plugin directory, update submodule and build. The server will automatically find the the solution file from the folder you have opened in Sublime. If you have multiple solutions you have to specify the solution file you wish to use in a sublime-project. Go to File -> Open and select the folder with your solution in it.

What is omnisharpsublime?

OmnisharpSublime is a plugin for ST3 to provide a C# development environment. It communicates with omnisharp-roslyn by nosami for IDE functions. Asynchronous communication with OmniSharpServer (Never freeze!) Code Actions eg. Convert LINQ query to Fluent Syntax


1 Answers

The current packaged version of omnisharp-sublime is using the omnisharp-server backend (NRefactory based), not omnisharp-roslyn (Roslyn based and support for Asp.Net 5 projects).

Work is ongoing both on omnisharp-roslyn, and the sublime plugin to make things work https://github.com/OmniSharp/omnisharp-sublime/tree/roslyn

I haven't tried it out yet (I'm an emacs guy), but from what I've heard, it's working really well! I use emacs with the omnisharp-roslyn server to develop omnisharp-roslyn with (the server itself is an Asp.Net 5 solution https://github.com/OmniSharp/omnisharp-roslyn)

like image 184
jasoni Avatar answered Sep 22 '22 21:09

jasoni