Reputation: 691
I'm using VS Code to try out ASP.NET a little bit, but when I try to do: dnu restore it fails.
If I try to do it within VS Code I get a error message: Omnisharp server not running.
I don't really know what to do :( I'm running Windows 10 x64
Upvotes: 23
Views: 52330
Reputation: 95
For me the issue was solved after installing the latest .NET SDK (6.0).
I got a more detailed error message after installing the .NET Extension Pack (https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.vscode-dotnet-pack).
Upvotes: 1
Reputation: 103
Most of the new omnisharp server problems are originated from your outdated dotnet version. I upgraded from .NET 5 to .NET 6.0, now it rocks!
Check your current version by writing "dotnet --version" to your terminal. And download the .NET 6 from the following link
Upvotes: 1
Reputation: 405
Another potential solution for folks in 2022 and later (IF the world is still here) -
Read the settings tooltip on that "Use Modern Net" option and see if it applies to your case. If you're using some versions >= than what this setting is for, you may have some other thing going on... In which case, I would recommend looking in that "Output" window at the bottom of VSCode and selecting C# and/or Omnisharp to see what errors it throws for debugging purposes. Hope this helps!
Upvotes: 3
Reputation: 11
I installed .NET SDK latest, and restart VScode. I were resolved problem. I so hope with you
Upvotes: 1
Reputation: 2525
Tried almost everything (resetting settings, reinstalling VS Code) to no avail. Finally I've downgraded VS Code C# extension from 1.25.0 to 1.24.4, and it worked perfectly.
Upvotes: 21
Reputation: 387
I solve this following this steps:
Now you can use ".Net: Generate assets for build and debug"
Upvotes: 2
Reputation: 106
Click f1 key or ctrl+shift+p to open the textbox to enter your command. Then type omnisharp server, and select the option 'Restart omnisharp server'.
You can look at its status in the bottom left corner of the window, and if you click on it, the process's status will on be displayed on the terminal.
Upvotes: 0
Reputation: 249
I had this problem when I opened the .cs file separately, but then I right-clicked the project folder and chose "Open with VSCode" and it worked fine
Upvotes: -1
Reputation: 11
I completely uninstalled the C# extension. Reinstalled it and change the Omnisharp timeout to 15 seconds (initially was 60). Works like a charm.
Upvotes: 1
Reputation: 10281
Check the vs code Omnisharp log, Ctrl + Shift + U.
The Omnisharp server is not running
error can result from a problem in your project.json
causing issues with dnu restore
. e.g. Issues resolving packages for one of the target frameworks?
It probably will not help but, you can try restarting Omnisharp : F1 "omni restart"
C# support is not bundled but it does sound like you have successfully installed it. Otherwise add C# with F1 "ext install", Enter, "C#"
You are right that there is little documentation
Upvotes: 12
Reputation: 1682
Visual Studio Code has Omnisharp built in. However, that doesn't mean you don't have to install ASP.NET 5 and DNX.
Follow the instructions found on this guide: https://code.visualstudio.com/Docs/runtimes/ASPnet5
Specifically, you'll want to follow these instructions: https://github.com/aspnet/home#upgrading-dnvm-or-running-without-visual-studio
Remember, Visual Studio is the heavyweight IDE that installs all that you need. Visual Studio Code is the lightweight node based editor that only has what you explicitly install/add to it. Thus, unlike Visual Studio, it does not automagically download ASP.NET 5 and DNX
Upvotes: 3