46

I generate an an offline installer for the build tools like this: vs_BuildTools.exe --layout c:\VS_BuildTools2017_offline --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools --lang en-US

I move this folder to a build agent (which has no internet connection, and no, it will never have one!), and then execute the vs_BuildTools.exe in that folder even with --noWeb or --noweb, but no matter what option I give, it will always fail with no internet connection available. Surely I am missing something, so any hints on what are appreciated

Joy
  • 1,171
  • 9
  • 15
n80fr1n60
  • 701
  • 1
  • 6
  • 12

2 Answers2

81

All steps to install build tools:

  1. Download build tools
  2. Download layout files for offline installation:
    • Possible workloads are specified here. Following command contains workloads for msbuild and C++ build tools.
    • Run (exe file will have some version numbers in name): vs_BuildTools.exe --layout c:\BT2017offline --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.WebBuildTools --add Microsoft.VisualStudio.Workload.NetCoreBuildTools --lang en-US
  3. Copy c:\BT2017offline to box on which you want to install it.
  4. Open mmc and import all certificates from c:\BT2017offline\certificates to "Trusted Root Certification Authorities" of computer (not current user)
  5. Run (exe file will have some version numbers in name): c:\BT2017offline\vs_BuildTools.exe --noweb
  6. Continue clicking next ...
JanSkalicky
  • 1,007
  • 1
  • 6
  • 10
  • 2
    Warning: You cannot install on Win Server 2012 R1 :) – RokX Feb 07 '18 at 13:40
  • 4
    i'd like to advise to add `--add Microsoft.VisualStudio.Component.NuGet.BuildTools --add Microsoft.Net.Component.4.5.TargetingPack` as [it is listed here](https://developercommunity.visualstudio.com/content/problem/137779/the-getreferencenearesttargetframeworktask-task-wa.html) – oleksa Apr 03 '18 at 14:16
  • When adding the certs it asks you for a password. I later found out you just leave them blank and continue. – Robert Brooker Jun 18 '18 at 22:34
  • 1
    I have it on Win Server 2012R2 – JanSkalicky Jun 28 '18 at 07:35
  • Will any of these components require a .NET Framework upgrade beyond version 4.5.2? – Kon Jan 22 '19 at 20:25
  • I followed these instructions exactly and everything went well until step 5. It seems to be ignoring the --noweb instruction. The installer times out and says it can't access the network to download the files. – btathalon Jul 19 '19 at 16:01
  • This should be the accepted answer. Worked great, and also works for VS 2019. BTW, if you are unsure how to use mmc here is a good [step by step guide on importing certs](https://support.globalsign.com/customer/en/portal/articles/1217281-import-and-export-certificate---microsoft-windows) – Brock Jul 31 '19 at 17:18
  • 1
    Also probably good to note, that if you are modifying an existing installation of the build tools, you still need to use `--layout` to build your new cache, but you **do not** use `--noWeb' on the target machine at that point, instead you have to updated the response.json as discussed [here](https://learn.microsoft.com/en-us/visualstudio/install/controlling-updates-to-visual-studio-deployments?view=vs-2019) – Brock Jul 31 '19 at 19:07
21

I also had problems with this.

One important step is to install the certificates before running the installer on the target machine:

  • Install the certificates, they are in the "certificates" folder, which is in your Layout folder. Right-click each one to install it. Remember to install the certs using the Admin account on the PC. I.e. not just for the current user.
  • Run the installation file.

Answer was originally posted here.

In addition I also noticed that when running the installer on the offline machine it has by default selected some more items than what was downloaded. I had to deselect them to only install the build tools, not the SDK and so on...

But still the install failed, I am currently seeing "An installation file did not download" so I have still not managed to complete the whole install. It's microsoft.visualstudio.vc.msbuild.arm64.vsix maybe it's included in some other component that have to be --added.

Update: Nevermind, my last problem was due to not using --noweb, with it there were no errors.

Zitrax
  • 19,036
  • 20
  • 88
  • 110