Implement dynamic support for VSDevCmd profiles #14638

Closed
opened 2026-01-31 04:15:36 +00:00 by claunia · 4 comments
Owner

Originally created by @heaths on GitHub (Jul 22, 2021).

I see a lot of developers adding entries to start the Visual Studio Developer Command Prompt, but its location can vary from machine to machine and multiple instances may be installed.

You can use the ISetupConfiguration COM server (the server is actually native, which is what we use in https://github.com/microsoft/vswhere) to find instances, which populate instances automatically if 1) installed, and 2) any instances are present.

A profile source could be something like VisualStudio_<InstanceId>. If the COM server can be created - ignoring REGDB_E_CLASSNOTREG - instances can be enumerated and command lines inferred from Common7\Tools\VSDevCmd.bat. As with any other dynamically discovered profile any number of profiles could be disabled.

The COM server supports Visual Studio 2017 and newer, but as with vswhere, older versions could be supported, though, IIRC, the actual batch file name and perhaps where it is located is different.

Originally created by @heaths on GitHub (Jul 22, 2021). I see a lot of developers adding entries to start the Visual Studio Developer Command Prompt, but its location can vary from machine to machine and multiple instances may be installed. You can use the [`ISetupConfiguration` COM server](https://docs.microsoft.com/dotnet/api/microsoft.visualstudio.setup.configuration.isetupconfiguration) (the server is actually native, which is what we use in https://github.com/microsoft/vswhere) to find instances, which populate instances automatically if 1) installed, and 2) any instances are present. A profile `source` could be something like `VisualStudio_<InstanceId>`. If the COM server can be created - ignoring `REGDB_E_CLASSNOTREG` - instances can be enumerated and command lines inferred from `Common7\Tools\VSDevCmd.bat`. As with any other dynamically discovered profile any number of profiles could be disabled. The COM server supports Visual Studio 2017 and newer, but [as with vswhere](https://github.com/microsoft/vswhere/blob/5d250b95a2c4d312961ed4e811fe240db197c404/src/vswhere.lib/InstanceSelector.cpp#L125-L142), older versions could be supported, though, IIRC, the actual batch file name and perhaps where it is located is different.
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 04:15:36 +00:00
Author
Owner

@skyline75489 commented on GitHub (Jul 22, 2021):

You may find #7774 interesting.

@skyline75489 commented on GitHub (Jul 22, 2021): You may find #7774 interesting.
Author
Owner

@zadjii-msft commented on GitHub (Jul 22, 2021):

Yea, this is /dup #3821

@zadjii-msft commented on GitHub (Jul 22, 2021): Yea, this is /dup #3821
Author
Owner

@ghost commented on GitHub (Jul 22, 2021):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Jul 22, 2021): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@heaths commented on GitHub (Jul 23, 2021):

Thanks. I searched for existing issues but didn't see anything obvious. I'll review it as well as the original author of the setup configuration server and vswhere.

@heaths commented on GitHub (Jul 23, 2021): Thanks. I searched for existing issues but didn't see anything obvious. I'll review it as well as the original author of the setup configuration server and vswhere.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14638