0

I am trying to install VS Studio 2019 build tools automated on a Windows Server 2019 instance using Powershell. Assuming the build tools bootstrapper shares the same command line interface as the regular ones, I want to install 2 Workloads with their recommended Components via --add. The MS documentation specifies the ;includeRecommended suffix to the WorkloadID. Proper recognition of the command flags seems to fail due to the ; in powershell. How can I tell the bootstrapper to include the recommended components of the workload?

Output:

PS C:\Users\Administrator> Invoke-WebRequest https://s3.eu-central-1.amazonaws.com/.../vs_buildtools
__1986933399.1585486755.exe -OutFile c:\vs.exe
PS C:\Users\Administrator> c:\vs.exe --passive --wait `
>> --add Microsoft.VisualStudio.Workload.MSBuildTools;includeRecommended `
>> --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended `
>> --add Microsoft.Component.MSBuild `
>>
includeRecommended : The term 'includeRecommended' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:2 char:52
+ ... add Microsoft.VisualStudio.Workload.MSBuildTools;includeRecommended `
+                                                      ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (includeRecommended:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

includeRecommended : The term 'includeRecommended' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:3 char:47
+ --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended `
+                                               ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (includeRecommended:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    includeRecommended flag for WorkloadId installment not reconized
Superlokkus
  • 103
  • 2
  • Thank you @GeraldSchneider that worked, I knew it was my lack of power shell experience. Please repost in answer form if you like. – Superlokkus Apr 01 '20 at 13:08

1 Answers1

1

place quotes around the parameter values.

c:\vs.exe --passive --wait `
  --add "Microsoft.VisualStudio.Workload.MSBuildTools;includeRecommended" `
  --add "Microsoft.VisualStudio.Workload.VCTools;includeRecommended" `
  --add Microsoft.Component.MSBuild `

In Powershell you can run multiple commands in a single line by separating them with ;. So, Powershell thinks that the command ends at the ; and searches for a cmdlet with the next name.

Alternatively, escaping them should also work:

  --add Microsoft.VisualStudio.Workload.MSBuildTools`;includeRecommended `
Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89