In the omnisharp-vscode wiki, it says:
When you install the C# extension for the first time it will try to download its dependencies. It needs to do this because the C# extension uses a number of platform-dependent files. So the extension itself contains the platform-neutral bits, and it will download the platform-specific bits on first use.
But… what if you would like to pre-install all dependencies of omnisharp vscode extension?
Well, this simple task demonstrated to not be as easy as it seems.
So, I came up with a Dockerfile
which does that for you:
FROM node:12.20.0-stretch as omnisharp-offline
RUN git clone --depth 1 https://github.com/OmniSharp/omnisharp-vscode.git /app
WORKDIR /app
RUN git checkout v1.23.7
RUN npm i && \
npm_package_engines_vscode="^1.44.0" node ./node_modules/vscode/bin/install && \
npm run compile && \
npm run gulp vsix:offline:package && \
rm -rf node_modules && \
rm -rf .razor && \
rm -rf .debugger && \
rm -rf .omnisharpFROM ubuntu:latest
COPY --from=omnisharp-offline /app/csharp.1.23.7-linux-x86_64.vsix /tmp/csharp.1.23.7-linux-x86_64.vsix
COPY --from=omnisharp-offline /app/csharp.1.23.7-darwin-x86_64.vsix /tmp/csharp.1.23.7-darwin-x86_64.vsix
COPY --from=omnisharp-offline /app/csharp.1.23.7-win32-x86_64.vsix /tmp/csharp.1.23.7-win32-x86_64.vsix
In the end, you have all .vsix
files in your new image — ready to be installed in VSCode, and with no dependencies. 😃