Create distinction between Visual Studio Instances (e.g. 2022 vs 2017) in Powershell

Create distinction between Visual Studio Instances (e.g. 2022 vs 2017) in Powershell
typescript
Ethan Jackson

On my Win11 PC I run two instances of Visual Studio concurrently. 2017 version for an 'API.cs' and 2022 version to run 'program.cs'.

Recently I had 'program.cs' hang on me, so I opened Powershell to kill it. Using the cmdlet 'gps | ? {$_.mainwindowtitle.length -ne 0}' I was presented with the below list, which showed no obvious distinction between the two instances:

HandlesNPM(K)PM(K)WS(K)CPU(s)IdSIProcessName
3194250347272389452716.00155841devenv
442133614114801588320140.19171161devenv

How can I reliably + automatically (either via cmdlet in my .ps1 or by changing an application setting) demarcate VS2017 and VS2022? Alternatively, what argument am I missing that would show extra detail which allows me to select the right instance to (on this occasion) kill VS2022?

Answer

I would start by making sure that API.cs and program.cs are part of different projects. The way I open projects is I pin Visual Studio to the taskbar (you should pin both of your versions). Once you've opened the correct project right right-click on that version of Visual Studio in the taskbar and pin the project to the recent files list. Then all you have to do going forward is right-click on the appropriate version of Visual Studio and left-click on the desired project.

enter image description here

If you want to make your two versions of Visual Studio look vastly different you can customized their icons:
enter image description here

Related Articles