microsoft / vssetup.powershell

PowerShell module to interact with Visual Studio Setup
MIT License
233 stars 41 forks source link

BuildTools 16.3 not getting selected #58

Closed NIBShura closed 5 years ago

NIBShura commented 5 years ago

I have BuildTools 16.3.8 installed on my machine Windows 10 1909 Build. image

And want to get the installation path for the MSBuild. Eventually I want to run following command to get the InstallationPath: Get-VSSetupInstance | Select-VSSetupInstance -Version '[16.2,)' -Latest | Select-Object -ExpandProperty InstallationPath

And I see nothing in output. So I tried debugging this and found that the Select-VSSetupInstance does not return anything.

PS C:\Windows\System32> Get-VSSetupInstance

InstanceId          : 50bb1fd5
DisplayName         : Visual Studio Build Tools 2019
InstallationVersion : 16.3.29503.13
InstallationPath    : C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
InstallDate         : 10/17/2019 9:31:32 AM

PS C:\Windows\System32> Get-VSSetupInstance | Select-VSSetupInstance
PS C:\Windows\System32>

What am I missing?

NIBShura commented 5 years ago

https://github.com/microsoft/vssetup.powershell/blob/d1247fe77566548ff67a9b45cc206294ce60c7a0/src/VSSetup.PowerShell/PowerShell/SelectInstanceCommand.cs#L50

This is not including "BuildTools"

Is that causing this issue?

heaths commented 5 years ago

It's by design. You need to specify -Product *. This is called out in the help:

    -Product <String[]>
        One or more products to select. Wildcards are supported.

        Required?                    false
        Position?                    named
        Default value                Microsoft.VisualStudio.Product.Community, Microsoft.VisualStudio.Product.Professional, Microsoft.VisualStudio.Product.Enterprise
        Accept pipeline input?       False
        Accept wildcard characters?  false

The original requirements were to find Visual Studio. At the time, Build Tools lacked many of the things required to call it "Visual Studio". Changing that would be a breaking change. It's the same for vswhere.