Click here to Skip to main content
15,860,844 members
Articles / Proxy
Tip/Trick

VS Code & .NET Core: Offline Installation of Extensions and Dependencies

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
10 Oct 2017CPOL2 min read 35.2K   1   2
Run .NET Core 2.0 SDK from Corporate Proxy

Introduction

This tip intended to resolve the possible issues in installing and executing the VS Code and .NET Core SDK 2.0 behind corporate proxy.

Steps

Install .NET Core SDK 2.0 and VS Code:

As stated in these articles 1, 2, the installation process from the command line is not detecting proxy settings properly. So if you are executing behind corporate proxy, the required dependencies: OmniSharp and .NET Core Debugger may fail to install.

JSON
Updating C# dependencies...
Platform: win32, x86_64

Downloading package 'OmniSharp (.NET 4.6 / x64)' (15684 KB) .................... Done!
Downloading package '.NET Core Debugger (Windows / x64)' (43510 KB) .................... Done!

Installing package 'OmniSharp (.NET 4.6 / x64)'
Installing package '.NET Core Debugger (Windows / x64)'
Failed at stage: installPackages
Error: end of central directory record signature not found

Finished

In order to resolve this problem, you need to install the dependencies manually.

  • The default location of VS Code extensions is "%USERPROFILE%.vscode\extensions\"
  • One of the extension is CSharp "ms-vscode.csharp-<version>". The run time dependencies are specified with in package.json file.
JSON
"runtimeDependencies": [
    {
      "description": "OmniSharp for Windows (.NET 4.6 / x86)",
      "url": "https://download.visualstudio.microsoft.com/download/pr/
             11114591/53def2e097a7e2c1a8bf567c6d81ad7a/omnisharp-win-x86-1.23.2.zip",
      "fallbackUrl": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x86-1.23.2.zip",
      "installPath": ".omnisharp",
      "platforms": [
        "win32"
      ],
      "architectures": [
        "x86"
      ],
      "installTestPath": "./.omnisharp/OmniSharp.exe"
    },

    {
      "description": ".NET Core Debugger (Windows / x64)",
      "url": "https://download.visualstudio.microsoft.com/download/pr/10975649/
              e7e53245607ac00f315a629e2ed934b9/coreclr-debug-win7-x64.zip",
      "fallbackUrl": "https://vsdebugger.blob.core.windows.net/coreclr-debug-1-12-5/
                      coreclr-debug-win7-x64.zip",
      "installPath": ".debugger",
      "platforms": [
        "win32"
      ],
      "architectures": [
        "x86_64"
      ],
      "installTestPath": "./.debugger/vsdbg-ui.exe"
    },  
  • You can download the dependencies manually using browser and unzip them in respective locations manually.
    1. "%USERPROFILE%.vscode\extensions\.omnisharp"
    2. "%USERPROFILE%.vscode\extensions\.debugger"
  • Developer have to create the folders ".omnisharp" and ".debugger" within the the C# extension folder "%USERPROFILE%.vscode\extensions\". These folders can't be created from Windows explorer as their names are starting with Dot. So you have to create them from the command line.
  • Restart the VS code and you will see the dependencies are recognized automatically.
    JSON
    Updating C# dependencies...
    Platform: win32, x86_64
    
    Skipping package 'OmniSharp for Windows (.NET 4.6 / x64)' (already downloaded).
    Skipping package '.NET Core Debugger (Windows / x64)' (already downloaded).
    
    Finished

Points of Interest

Even after the successful installation of dependencies, the project may fail to execute. You may get error "Could not find the preLaunch task 'build'".

  • If you are encountering this issue, just delete the ".vscode" folder within the solution workspace folder.
  • Reload the VS code and hit F5 (Debug).
  • When VS Code asks to select type of debugging needed, just press "Escape" key without selecting any debugger.
  • VS Code will detect the project and created necessary support files automatically.
  • Next time, your project will run without any issues.

Reference

History

  • 2017/10/10 - Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
India India
I have been programming for last 20 years on various platforms including .NET, Visual Basic 6, Oracle and SQL server.

I decided to write articles when I have free time hoping to share my thoughts with you.

To know more about me visit http://sabarinathanarthanari.com

Comments and Discussions

 
PraiseExactly what I needed! Thanks! Pin
Simmy726-Dec-18 23:23
Simmy726-Dec-18 23:23 
QuestionMy solution was slightly different Pin
Member 1368172916-Feb-18 4:57
Member 1368172916-Feb-18 4:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.