microsoft / vssetup.powershell

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

What's the equivalent of vswhere -find in vssetup.powershell #52

Closed icraftsoftware closed 5 years ago

icraftsoftware commented 5 years ago

Hello

I would prefer to use vssetup.powershell, which is PowerShell native than vswhere.exe. However I can't find the PowerShell equivalent for the -find parameter of vswhere. For instance:

vswhere.exe -latest -requires Microsoft.VisualStudio.TestTools.TeamFoundationClient -find **\Microsoft.TeamFoundation.Client.dll

Is it supported by PowerShell? If so, how should I write it?

Thank you for your help

François

PS: this is a duplicate of vswhere:issue#189

heaths commented 5 years ago

This is already possible in PowerShell through a number of ways:

  1. Pipe to Get-ChildItem:
    Get-VSSetupInstance -Prerelease | Get-ChildItem -Recurse -Filter Microsoft.TeamFoundation.Client.dll
  2. Convert vswhere output to JSON (this format was partly selected to support PowerShell):
    vswhere.exe -latest -format json -requires Microsoft.VisualStudio.TestTools.TeamFoundationClient -find **\Microsoft.TeamFoundation.Client.dll | ConvertFrom-Json | Get-Item

    PowerShell's support for JSON provides many PowerShell-native possibilities from a myriad of tools like vswhere. And, of course, stitching together different PowerShell examples like in the first example is what makes it such a powerful tool. As such, I have no plans to add this same functionality to the cmdlets as multiple possibilities exist, whereas in many environments that use vswhere as a provider such information was less accessible (e.g. batch script).