how do I get the Omnisharp extension to work in Visual Studio Code

16,605

Solution 1

I had the problem previously. So did setup proxy and other at settings.json. But now in new VS Code, i was getting same problem weirdly. Finaly when i emptied out the settings.json file (deleted all the settings) VS code is working. It automatically downloads C# and other extentions. So, give it a try, if you had some settings put there for previous versions of VS Code, you got to remove(comment) them to check if thats cuasing problems. [You dont have proxy, but if someone have, 'yes of course proxy needed to setup for .npmrc and enviroment variables at cmd as internet is necessary to download files]

Solution 2

This article has a section at the end about installing downloaded extension as vsix files. It also mentions the error you described and about how it could be proxy related. It is a somewhat long article... but I hope this helps.

https://code.visualstudio.com/docs/editor/extension-gallery

"Can I download an extension directly from the Marketplace? Some users prefer to download an extension once from the Marketplace and then install it multiple times from a local share. This is useful when there are connectivity concerns or if your development team wants to use a fixed set of extensions.

To download an extension, navigate to the details page for the specific extension within the Marketplace. On that page, there is a Download Extension link in the Resources section which is located on the right hand side of the page.

Once downloaded, you can then install the extension via the Install from VSIX command in the Extensions view command drop-down."

Solution 3

The installation should be easier with VSCode 1.61 (Sept. 2021) because, as OmniSharp/omnisharp-vscode issue 4775 mentions:

VS Code now supports platform specific extensions.
This should be very useful for C# since currently you download platform binaries after activation.

As detailed in Publishing Extensions / Platform-specific extensions:

Extensions can publish different VSIXs for each platform (Windows, Linux, macOS) VS Code is running on.
This is useful if your extension has platform-specific libraries or dependencies, so you can control the exact binaries that are included in a platform package.
A common use case is the use of native node modules.

When installing a platform-specific extension, VS Code (starting from version 1.61.0) looks for the extension package that matches the current platform.
If no package has been published for the platform, the extension will appear as disabled and can not be installed.
Therefore, you need to publish a package for each and every platform that your extension supports. To meet this requirement, we are providing tooling to help make this potentially repetitive process easier.

This is followed by the 2018 microsoft/vscode issue 23251

Solution 4

What worked for me was this:

  1. (press crtl + shift + P) then choose Preferences > Open settings
  2. Comment these lines out if they are there:

// "http.proxySupport": "on", // "http.proxyAuthorization": null,

After I did this, the extension was able to use the proxy settings, and the extension downloaded and worked!

Share:
16,605

Related videos on Youtube

krazyk4tlady
Author by

krazyk4tlady

Updated on June 04, 2022

Comments

  • krazyk4tlady
    krazyk4tlady almost 2 years

    In Visual Studio Code I tried to install the Omnisharp extension so that I can get formatting (among other things).

    this is the c# log: Installing C# dependencies... Platform: win32, x86_64

    Downloading package 'OmniSharp for Windows (.NET 4.6 / x64)' Retrying from 'https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x64-1.32.8.zip' Failed at stage: downloadAndInstallPackages Error: connect ETIMEDOUT 93.184.215.201:443

    You can also tell the extension didn't install by the Omnisharp log error: Starting OmniSharp server at 1/9/2019, 4:17:59 PM Target: c:\Users[myUserId]\source\project-folder OmniSharp server started. Path: C:\Users[myUserId].vscode\extensions\ms-vscode.csharp-1.17.1.omnisharp\1.32.8\OmniSharp.exe PID: 15188

    The system cannot find the path specified. [ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

    It seems like the version 1.32.8 is not available, but https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x64-1.30.1.zip is. I downloaded the package, extracted filed, and tried to placed the folder where it's expected: C:\Users[myUserId].vscode\extensions\ms-vscode.csharp-1.17.1.omnisharp\1.30.1\OmniSharp.exe -- but windows doesn't allow folder names starting with a dot in this location. I thought I had figured out a solution and I didn't.

    • Lex Li
      Lex Li over 5 years
      Change Windows Explorer settings to show hidden folders, and then you can open "C:\Users[myUserId]\.vscode\extensions\" easily to manipulate the folders.
    • stuzor
      stuzor almost 5 years
      Do you remember how you solved this problem? I've got a terrible internet connection overseas, and dotnet downloader just hangs. So I've managed to download the same omnisharp .zip on a cloud VM and sync it to my computer with btsync. Now I don't know what to do with the .zip file... It doesn't have a .vsix file...
  • krazyk4tlady
    krazyk4tlady over 5 years
    The problem is likely the proxy, but in my company there is no way to change proxy settings. As for the download, I can only see a link for downloading the source code..
  • Eric D
    Eric D over 5 years
    @krazyk4tlady - Here's what I did - I went to github.com/OmniSharp/omnisharp-vscode/releases and downloaded the file named csharp-1.18.0-beta4.vsix. There are other versions there as well. I opened VS Code and then went to View -> Terminal and added a command like this at the prompt: code --install-extension "C:\Users[my user id]\Downloads\csharp-1.18.0-beta4.vsix"
  • Eric D
    Eric D over 5 years
    But I don't have a proxy in my way... please let me know what happens