VSCode离线安装C/C++插件以及依赖包

网上有很多关于VSCode离线安装C/C++插件的博客,在这里我就不加累述了,其实完成这一步,插件还并不能正常使用。因为插件还有许多依赖包需要联网下载,如果电脑没有联网的话,将会下载依赖包超时Updating C/C++ dependencies... Downloading package Error:
解决办法如下:
1.找到你安装vscode.cpptools插件的目录:一般是C:\Users\用户名\.vscode\extensions\ms-vscode.cpptools-0.20.1
2.打开文件夹里的package.json文件,这个文件的最后几行有依赖包的下载路径:这些路径会随着版本的变化有所更新。我的package.json文件里下载路径如下:
3.其中Windows系统下的依赖包有:C/C++ language components (Windows),ClangFormat (Windows),Visual Studio Windows Debugger(我的下载链接:VSCode Cpptools依赖包
4.解压这些文件,会出来三个文件夹:bin,debugAdapters,LLVM。把debugAdapters,LLVM这两个文件夹直接放在插件根目录一般是C:\Users\用户名\.vscode\extensions\ms-vscode.cpptools-0.20.1,把bin文件夹里的文件:Microsoft.VSCode.CPP.Extension.exe,Microsoft.VSCode.CPP.IntelliSense.Msvc.exe放到C:\Users\用户名\.vscode\extensions\ms-vscode.cpptools-0.20.1\bin文件夹下。
5.在插件根目录一般是C:\Users\用户名\.vscode\extensions\ms-vscode.cpptools-0.20.1,新建一个空的文件,文件命名为install.lock,为了给这些新的文件上锁。
6.大功告成,可以正常使用了!(不能上网的公司伤不起啊!!!)

  "runtimeDependencies": [
    {
      "description": "C/C++ language components (Linux / x86_64)",
      "url": "https://go.microsoft.com/fwlink/?linkid=2036673",
      "platforms": [
        "linux"
      ],
      "architectures": [
        "x86_64"
      ],
      "binaries": [
        "./bin/Microsoft.VSCode.CPP.Extension.linux",
        "./bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux"
      ]
    },
    {
      "description": "C/C++ language components (Linux / x86)",
      "url": "https://go.microsoft.com/fwlink/?linkid=2036672",
      "platforms": [
        "linux"
      ],
      "architectures": [
        "x86",
        "i686",
        "i386"
      ],
      "binaries": [
        "./bin/Microsoft.VSCode.CPP.Extension.linux",
        "./bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux"
      ]
    },
    {
      "description": "C/C++ language components (OS X)",
      "url": "https://go.microsoft.com/fwlink/?linkid=2036674",
      "platforms": [
        "darwin"
      ],
      "binaries": [
        "./bin/Microsoft.VSCode.CPP.Extension.darwin",
        "./bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.darwin"
      ]
    },
    {
      "description": "C/C++ language components (Windows)",
      "url": "https://go.microsoft.com/fwlink/?linkid=2036671",
      "platforms": [
        "win32"
      ],
      "binaries": []
    },
    {
      "description": "ClangFormat (Linux / x86_64)",
      "url": "https://go.microsoft.com/fwlink/?LinkID=872607",
      "platforms": [
        "linux"
      ],
      "architectures": [
        "x86_64"
      ],
      "binaries": [
        "./LLVM/bin/clang-format"
      ]
    },
    {
      "description": "ClangFormat (Linux / x86)",
      "url": "https://go.microsoft.com/fwlink/?LinkID=872608",
      "platforms": [
        "linux"
      ],
      "architectures": [
        "x86",
        "i686",
        "i386"
      ],
      "binaries": [
        "./LLVM/bin/clang-format"
      ]
    },
    {
      "description": "ClangFormat (OS X)",
      "url": "https://go.microsoft.com/fwlink/?LinkID=872609",
      "platforms": [
        "darwin"
      ],
      "binaries": [
        "./LLVM/bin/clang-format.darwin"
      ]
    },
    {
      "description": "ClangFormat (Windows)",
      "url": "https://go.microsoft.com/fwlink/?LinkID=872610",
      "platforms": [
        "win32"
      ],
      "binaries": []
    },
    {
      "description": "Mono Framework Assemblies",
      "url": "https://go.microsoft.com/fwlink/?LinkId=2027135",
      "platforms": [
        "linux",
        "darwin"
      ],
      "binaries": []
    },
    {
      "description": "Mono Runtime (Linux / x86)",
      "url": "https://go.microsoft.com/fwlink/?LinkId=2027410",
      "platforms": [
        "linux"
      ],
      "architectures": [
        "x86",
        "i686",
        "i386"
      ],
      "binaries": [
        "./debugAdapters/mono.linux-x86"
      ]
    },
    {
      "description": "Mono Runtime (Linux / x86_64)",
      "url": "https://go.microsoft.com/fwlink/?LinkId=2027416",
      "platforms": [
        "linux"
      ],
      "architectures": [
        "x86_64"
      ],
      "binaries": [
        "./debugAdapters/mono.linux-x86_64"
      ]
    },
    {
      "description": "Mono Runtime (OS X)",
      "url": "https://go.microsoft.com/fwlink/?LinkId=2027403",
      "platforms": [
        "darwin"
      ],
      "binaries": [
        "./debugAdapters/mono.osx"
      ]
    },
    {
      "description": "LLDB 3.8.0 (OS X)",
      "url": "https://go.microsoft.com/fwlink/?LinkID=817244",
      "platforms": [
        "darwin"
      ],
      "binaries": [
        "./debugAdapters/lldb/bin/debugserver",
        "./debugAdapters/lldb/bin/lldb-mi",
        "./debugAdapters/lldb/bin/lldb-argdumper",
        "./debugAdapters/lldb/bin/lldb-launcher"
      ]
    },
    {
      "description": "Visual Studio Windows Debugger",
      "url": "https://go.microsoft.com/fwlink/?linkid=872985",
      "platforms": [
        "win32"
      ],
      "binaries": []
    }
  ]

 

©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页