At my company, we are using Visual Studio 2017 Professional for much of our development. We are now setting up a build server, and then we want to install Visual Studio build tools.
We have done this successfully before, but now our build server does not have an Internet connection. It should be possible to install Visual Studio build tools anyway, by following this guide: https://learn.microsoft.com/en-us/visualstudio/install/create-an-offline-installation-of-visual-studio?view=vs-2017
According to the guide, you should create a local cache from the command line. I have done this, by:
- Downloading Build Tools for Visual Studio 2017: https://visualstudio.microsoft.com/downloads/
- Opening cmd.exe
Running this command:
vs_buildtools__1995328593.1509370754.exe --layout c:\VS_BuildTools2017_offline --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools --lang en-US --includeOptional
(The --includeOptional flag includes lots of extra things that is not really needed. It can be replaced with --includeRecommended.)
It created the cache in C:\VS_BuildTools2017_offline, and I copied the folder to the build server. I have verified that the cache is good, locally and on the server, with this command:
vs_buildtools__1995328593.1509370754.exe
--layout C:\VS_BuildTools2017_offline
--verify
To install I first only ran this command:
vs_buildtools__1995328593.1509370754.exe
--add Microsoft.VisualStudio.Workload.MSBuildTools
--add Microsoft.VisualStudio.Workload.VCTools
--includeOptional
That command opened up the installer GUI, where I can add or remove components. After clicking next, the installer tries to download more packages from the Internet, which of course fails as there is no Internet connection:
After nine attempts, there was a problem downloading the following file, which is required to continue: https://download.visualstudio.microsoft.com/download/pr/1de262ec-7472-432e-aeac-5faba4582d01/8d4d2cb3863cda850f87ee6e3e881fae/microsoft.build.vsix
Select Retry to try downloading the file again.
Select Cancel to cancel the Visual Studio install.
I have tried to include less packages when installing, but it does the same thing.
I found this link after some more searching: https://developercommunity.visualstudio.com/content/problem/303465/inability-to-install-build-tools-for-visual-studio.html
It sound a bit like the problem that I have had, and the reason in that case was that some of the components needs certificates to be installed. If they are not installed, then the installer tries to get them from the Internet to make sure that they are good ones. The solution in that case was to manually install the certificates, from the install layout in c:\VS_BuildTools2017_offline\certificates.
I tried that solution with the .bat file, and all of them were installed successfully. This made no difference for the installation, and it still tried to download files.
I contacted the support chat for Visual Studio, and they helped me go through almost the same steps again. Then we tried to install the certificates by double clicking each certificate, choosing "For local user", then "Place all certificate in following store", and then the path as "Trusted root certificate authority". Still no difference.
Any idea of how to fix this? It should be possible to do this without connecting the build server to the Internet again, right?