Closed DziubanMaciej closed 3 years ago
The duplicate installPath looks like a bug, however, it might be a harmless one - I routinely use --installPath with workload packages and I've never encountered such a failure before.
On the other hand, https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2019 states that "--path shared=..." is accepted only during the first installation of VS, so this might be what's causing the error 87.
I would think so too, if it didn't succeed without the "--installPath" parameter. Anyway, I tried removing "--path shared=...", but it didn't change anything, still error 87.
choco install "visualstudio2019-workload-nativedesktop" -y --packageparameters="--installPath=`"D:\Programs\VisualStudio\2019`""
Maybe it happens only in setups with a single VS installation? Do you have multiple?
Whenever a new VS 2019 Preview version is released I test it by installing all VS products one after another, each with a different installPath. However, that test does not include installing any workloads, so if the bug affects workloads only, that would explain why I had not discovered it earlier.
It's still strange because I had explicitly tested installing a VS product with several workloads to a custom path a couple of months ago (I can't remember if it was with extension version 1.8.1 or 1.9.0, though).
Anyway, I'll be able to do something about it once I return from vacation - in a week or so.
Yup, it's probably related to workloads only, I didn't have any problems with installing VS itself.
Didn't want to interrupt anything, have a great time on your vacation!
Ah, there's the problem:
choco install "visualstudio2019-workload-nativedesktop" -y --packageparameters="--installPath=`"D:\Programs\VisualStudio\2019`""
Running 'Start-VSServicingOperation' for visualstudio2019-workload-nativedesktop with silentArgs:'modify --installPath=D:\Programs\VisualStudio\2019 --installPath D:\Programs\VisualStudio\2019
If you look closely, the difference between the two seemingly identical parameters is in the equals symbol (=).
The syntax of VS package parameters (and the VS installer) is such that the parameter name is always separated from the parameter value by spaces, not by "=". The only place where the equals symbol appears is in the possible values of the --path
parameter (but still, it is inside the value, not as a separator between parameter name and value).
As such, the packages do not contain any logic for recognizing the = symbol and simply split the parameters string by the delimiter --
(space and two dashes)*. Therefore, the entire string installPath=D:\Programs\VisualStudio\2019
is treated as the parameter name and (because it does not match any parameter names the package script cares about) is passed unmodified to the VS Installer.
To sum up - please fix your choco invocation as follows:
choco install "visualstudio2019-workload-nativedesktop" -y --packageparameters="--installPath D:\Programs\VisualStudio\2019"
* the second benefit of this simple syntax is that paths with spaces do not need to be quoted in any way; this will work as expected: --package-parameters "--installPath D:\Path with spaces\Visual Studio 2019 Enterprise --includeRecommended"
Wow, feeling dumb now... 😄 Thank you very much for the explanation, it works like a charm.
The choco following command fails installation (specified paths are correct):
For full log, please see attached chocolatey.log file. The important part is:
I'm pretty sure this is because of duplicate "--installPath" parameters being passed to the native installer. One comes from package parameters and the second from the package itself. I would expect the package to drop the latter, when the former is specified.
I have only one VS installation on my system, so I can just drop it from package parameters (command below works), but this would be a bug in a multi-installation setup.