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





5.00/5 (3 votes)
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.
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.
"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.
- "%USERPROFILE%.vscode\extensions\.omnisharp"
- "%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.
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