Why doesn't the Visual Studio 2017 Build Tools installer work? - visual-studio

I have Windows running in a VMware VM, to which I connect via SSH. I can run a Command Prompt or a PowerShell. I'm trying to follow the instructions to install Visual Studio 2017 Build Tools from a command line. I download the installer from https://aka.ms/vs/15/release/vs_buildtools.exe and name it vsbt2017.exe, the "installation channel" from https://aka.ms/vs/15/release/channel and name it vs2017.chman, and I create an empty directory for the installation at C:\vs2017.
When I try this command in Command Prompt, it does not return immediately, waits a few seconds, then returns. My install path remains empty. No error message is printed to the terminal. %ERRORLEVEL% is 1.
start /wait .\vsbt2017.exe --quiet --wait --norestart --nocache --installPath C:\vs2017 --channelUri C:\vs2017.chman --installChannelUri C:\vs2017.chman --add "Microsoft.VisualStudio.Workload.VCTools;includeRecommended"
When I try this command in PowerShell, I get the same results. The analog of this command works for me for VSBT 2019, so it's really puzzling why it doesn't work for 2017.
Start-Process -FilePath C:\vsbt2017.exe -ArgumentList "--quiet --wait --norestart --nocache --installPath C:\vs2017 --channelUri C:\vs2017.chman --installChannelUri C:\vs2017.chman --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended" -Wait -PassThru
If it makes a difference, I already have VSBT 2019 installed on this VM, but I've read in Microsoft's documentation that multiple versions can be installed simultaneously.
Almost two years ago, I asked a similar question about the 2019 Build Tools installer. This time, I need to install the 2017 Build Tools. The reason is that I need to figure out why someone else's installation of Visual Studio 2017 doesn't work, so I need to test with their version. "Just install Visual Studio 2019" is not an acceptable answer to this question.

Related

Could not install microsoft.netcore.hostpath 2019

I am trying to install Visual Studio 2019 but unfortunately every time I get this error
could not install Microsoft.NetCore.HostPath
Here is an image of the same:
Solution worked for me (nothing else helped)
Install PowerShell v7 (https://aka.ms/pscore6)
Backup original PowerShell v1 from C:\Windows\SysWOW64\WindowsPowerShell\v1.0
Copy "C:\Program Files\PowerShell\7" to C:\Windows\SysWOW64\WindowsPowerShell\v1.0
Rename pwsh.exe to powershell.exe
Now VS installer is using PowerShell v7 thinking it is v1, works fine!
So, I believe it is kid of bug in old version of PowerShell
Probably there is better way to mimic version, I just did old school brutal magic after loosing a day for that
If you have .Net 5 on your system and updating to 16.11.8 then you may face this issue. Till now only work around is to downgrade to 16.11.7.
And you may have in uninstall and then reinstall VS 2019. You can get 16.11.7 or other older version of VS from following URL:
https://learn.microsoft.com/en-us/visualstudio/releases/2019/history
Similar issue has been reported here too: Revert Visual Studio 2019 Update
Activate the PowerShell privilege's, run gpupdate then restart the machine. then reinstall the setup again.
Set powershell execution policy to unrestricted. Open privileged powershell console and type
Set-ExecutionPolicy Unrestricted
re-execute setup.
Getting Windows PowerShell access worked for me.
I was not able to install VS2019 and VS2022.

Can Visual Studio 2019 Community be installed on WIndows Server 2016 Core?

Can I silently install Visual Studio 2019 Community on a Windows 2016 Core docker container? I've followed the instructions to download the VS Community exe then extract to a vslayout folder. I copied this folder to my Windows 2016 Server core docker container during build and I try to run the install using:
RUN .\vs_setup.exe --add Microsoft.VisualStudio.Workload.NetCrossPlat --includeRecommended --quiet --norestart
During the build I get a couple of lines like the following and the last one being:
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\e1ab6aced6786d403760\vRemoving intermediate container 67a8e8bebba1
Then the rest of the container build continues and finishes with no errors but you can tell none of the cross platform libraries were installed, not to mention the installed completed too fast anyway so it's no suprise.
Am I wasting my time? Is it even possible to do this in windows container? I just want to be able to build my xamarin.android apps in a windows server 2016 core build agent.
I figured it out. (I assume) you have to use Visual Studio Build Tools. For help on how to set it up just go to docker hub and find the microsoft .net framework sdk windows image and look at the dockerfile. You'll see how they setup the build tools. Then Google the term visual studio build tools workloads to find whatever build components you want to add.
Based on the Microsoft dockerfile, here is my relevant edited part that got me going with android development:
&& setx /M DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1 `
&& start /w vs_BuildTools.exe ^ `
--add Microsoft.VisualStudio.Workload.MSBuildTools ^ `
--add Microsoft.VisualStudio.Workload.NetCoreBuildTools ^ `
--add Microsoft.Net.Component.4.8.SDK ^ `
--add Microsoft.VisualStudio.Workload.XamarinBuildTools;includeOptional ^ `
--quiet --norestart --nocache --wait `
&& powershell -Command "if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { throw $err }" `
&& del vs_BuildTools.exe `

Visual Studio 2017 installer fails to install KB2533623

I'm trying to install Visual Studio 2017 Community via web installer on my Windows 7 laptop and it fails, returning me this log:
dd_setup_..._error.log (translated into English from me, since it was in German)
Package "WindowsUpdates.KB2533623,version=15.0.26711.1,chip=x64" could not be installed.
Search-URL
https://aka.ms/VSSetupErrorReports?q=PackageId=WindowsUpdates.KB2533623;PackageAction=Install;ReturnCode=1168
Details
Command executed: "C:\Windows\system32\dism.exe" /online /quiet /norestart /add-package /packagepath:"C:\Users\User\AppData\Local\Temp\462b07d7-22c4-4fb6-8bd8-78e9e210c711\Windows6.1-KB2533623-x64.cab" /logPath:"C:\Users\User\AppData\Local\Temp\dd_setup_20170916213606_141_WindowsUpdates.KB2533623.log"
Code returned: 1168
Codedetails returned: Element not found.
KB2533623 is not installed at my Laptop, so I tried to install KB2533623 x64 by myself, but it's rejecting with the words "The update is not applicable to your computer".
After some research I found SCCMENTOR who is claiming KB2533623 is superseded by KB2758857, so I tried to uninstall KB2758857, first. There was an error that I could not uninstall all updates. Repeating the step in a local system CMD with wusa /uninstall /kb:2758857 returned 0x80070490. Microsoft suggests to scan the system for corrupt files with sfc /scannow, so I did. It found some errors and fixed them.
I repeated wusa /uninstall /kb:2758857 and it returned 0x80070bc9. Then I restarted and tried it another time and it gives me 0x80070490, again.
I'm not sure I'm on the right path, maybe KB2533623 is not the problem here. How can I fix the problem, so the Visual Studio installer is able to install KB2533623 that is required by so many components of the suite? If KB2533623 is really superseded by KB2758857, why the installer tries to install KB2533623 at all, if KB2758857 is already installed on my laptop?
Microsoft fixed it in Visual Studio 2017 15.5 Preview 3
Visual Studio 2017 15.3 installation fails with „Failed to install WindowsUpdates.KB2533623“ error message.
Visual Studio 2017 install fails due to missing Windows6.1-KB2533623-x64.cab.
So wait for the Final of the Visual Studio 2017 version 15.5 and use the updated installer.
​Hello people!
I had the same problem, and I found that the KB2533623 superseded by KB2758857.
I checkout if this update was installed in my PC. You can check it running this command:
wmic qfe list | find "2758857"
This will show something like this if it was installed:
http://support.microsoft.com/?kbid=2758857 MyMachine Security Update KB2758857 AUTORIDADE NT\SISTEMA 9/2/2016
So, I removed it with this command:
wusa /uninstall /kb:2758857
After this I can install with success the visual studio 2017.
I hope it can help you.

Is it possible to install Visual Studio in a Windows Container

Is it possible to install any version of Visual Studio in a Windows Container on a Windows Server?
The motivation is to use Windows Containers for building software in continuous integration systems, so that the build environment is standardized.
Visual Studio seems to not be supported officially on Core Server, but I agree it would be really nice to be able to do this. Let's try:
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell"]
RUN Invoke-WebRequest "https://aka.ms/vs/16/release/vs_community.exe" -OutFile "$env:TEMP\vs_community.exe" -UseBasicParsing
RUN & "$env:TEMP\vs_community.exe" --add Microsoft.VisualStudio.Workload.NetWeb --quiet --wait --norestart --noUpdateInstaller | Out-Default
RUN & 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe' /version
CMD ["powershell"]
(I'm pushing this image into lukaslansky/visualstudio-netwebworkload, use with caution.)
Output of the build is:
[...]
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
So this seems to work! You should play with those --add installator arguments to specify what components you need precisely for your build, they correspond to workloads and components you see in the GUI. See the documentation.
Your best bet at this point is to use Visual Studio Build Tools.
A way to install visual build chain in a windows container could be to use chocolatey package visualstudio2017buildtools.
Starting Dockerfile with something like :
FROM microsoft/windowsservercore
RUN powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SETX PATH "%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN choco install -y visualstudio2017buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --installPath C:\BuildTools" || IF "%ERRORLEVEL%"=="3010" EXIT 0
RUN call "C:\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
Just for the record MS is not planning support VS inside containers, the best alternative that you have is MsBuild. Some months ago was possible but with the latest version from VS is not possible. Source: vsts-agents
Windows Containers do not currently include GUI apps. The limitation is on Microsoft, not on Docker.
For example try something simple like running Notepad (in Windows Server Core container). The process is launched but no GUI shows up.
I've recently spent a lot of time investigating this as our goal was to set up "dockerized" DevOps agents which were capable of running the VsBuild#1 pipeline task (among other things).
Generally, if you DON'T need VsBuild#1 (or some of the other tasks related to Visual Studio, like VsTest#2 or the like) then you're better of using https://hub.docker.com/_/microsoft-dotnet-framework-sdk/ as your base and call it a day; those images come with the Build Tools and VS Test agent already installed.
However it IS possible to install VS. Some notes:
I've had issues when installing VS on top of the images mentioned above. For some reason VS silently fails to copy some files when it detects some existing tools already being in place. As such, I recommend using the https://hub.docker.com/_/microsoft-dotnet-framework-runtime/ images as a base.
Installation must be "quiet" (since there's no GUI) and cannot request a restart.
From what I can tell VS would usually queue up some kind of pre-build process which isn't triggered when the system isn't restarted. This can be manually triggered, however, by running %windir%\Microsoft.NET\Framework64\v4.0.30319\ngen update. Do note that with a VS installation inside Docker this WILL fail in various ways, so you'll need to find ways around this.
Check the original DockerFile for the SDK images for some references; specifically interesting is the manual installation of .NET Framework targetting packs: https://github.com/microsoft/dotnet-framework-docker/blob/main/src/sdk/4.8.1/windowsservercore-ltsc2022/Dockerfile
(Should this link ever stop working because the file is moved then it's worth taking a look at the DockerFiles in the https://github.com/microsoft/dotnet-framework-docker repo)
Not all VS components can be installed! While I haven't nailed it down to which components are troublesome, a full VS install inside Docker will likely exceed default Docker disk space limits and / or run endlessly (soft lock as some proces will wait forever for some other installation process to finish). As such it is important to carefully curate the list of VS component IDs you wish to install using --add arguments.

How to install Visual Studio Remote Tools on Server Core?

I'd like to install the Visual Studio 2013 Update 4 Remote Tools on a Windows 2012R2 Server running IIS 8.5. This is a pretty simple process outlined here: https://msdn.microsoft.com/en-us/library/bt727f1t.aspx
The problem I have is that the server I'm trying to installing this on is a Server Core, meaning, there is no GUI. The Remote Tools application is an exe that only installs via GUI.
I've tried to install it with PowerShell and it just hangs. I'm also not able to find the Remote Tools in Web Platform Installer to install it that way. Extensive Googling has turned up nothing.
Does anyone know how to install the Visual Studio Remote Tools on a Server Core so that I can debug on my DEV server? Any advice is appreciated.
Create a .bat file and enter the below. (not PowerShell) (Or just at the command line.)
rtools_setup_x64.exe" /install /quiet
word...
You don't have to install remote tools. Just copy msvsmon.exe, from your local Visual Studio installation. Then start it from remote powershell silently:
Start-Process -FilePath .\msvsmon.exe -ArgumentList '/nosecuritywarn /port:4022 /silent' -Verb runAs
Don't forget to open firewall port.
Turns out that you can simply remote into the Core server. When you do so, you'll get a command prompt only. From there, CD to the directory where the remote tools install file is. Execute the file by typing the file name at the command prompt, ie: rtools_setup_x64.exe.
This will run the installer, with a GUI, on the Core server. Its that simple, I didn't think you'd be able to get the install wizard on a Core server, however you do.

Resources