-
-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Mentioned by @odalet from #13 (comment)
If I simply run hmsbuild, the returned version of MSBuild is 15.8 (btw I don't know why the more recent 16.0 one is not picked...)
So what's going on if we're talking about VS2017+
This is so, because of this:
Lines 469 to 471 in 4b368c9
| if defined vspath if defined vsver ( | |
| call :vswmsb vspath vsver msbf | |
| if defined msbf goto _vswbinReturn |
But in general, it depends on installation order in your machine and current ISetupConfiguration2.EnumAllInstances / IEnumSetupInstances.Next implementation. Which may sort the available products by something.
vswhere will just enumerate it 'as is' (see installation API):
- https://github.com/microsoft/vswhere/blob/a6d40ba5f406f0eba87079240f4fd022c11cbf1e/src/vswhere/Program.cpp#L116
- https://github.com/microsoft/vswhere/blob/f078b21784b53dd811ad72f0334b7b70f22aa9cf/src/vswhere.lib/InstanceSelector.cpp#L111
just installed 2017 & 2019 on clean VM:
:: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community "
:: "15.9.28307.770 "
:: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community "
:: "16.1.29102.190 "that is:
instanceId: 2d0578b0
installDate: 7/19/2019 5:49:56 AM
installationName: VisualStudio/15.9.14+28307.770
installationPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
installationVersion: 15.9.28307.770
productId: Microsoft.VisualStudio.Product.Community
productPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe
state: 4294967295
isComplete: 1
isLaunchable: 1
isPrerelease: 0
isRebootRequired: 0
displayName: Visual Studio Community 2017
description: Free, fully-featured IDE for students, open-source and individual developers
channelId: VisualStudio.15.Release
channelUri: https://aka.ms/vs/15/release/channel
enginePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service
releaseNotes: https://go.microsoft.com/fwlink/?LinkId=660692#15.9.14
thirdPartyNotices: https://go.microsoft.com/fwlink/?LinkId=660708
updateDate: 2019-07-19T12:49:56.4989618Z
catalog_buildBranch: d15.9
catalog_buildVersion: 15.9.28307.770
catalog_id: VisualStudio/15.9.14+28307.770
catalog_localBuild: build-lab
catalog_manifestName: VisualStudio
catalog_manifestType: installer
catalog_productDisplayVersion: 15.9.14
catalog_productLine: Dev15
catalog_productLineVersion: 2017
catalog_productMilestone: RTW
catalog_productMilestoneIsPreRelease: False
catalog_productName: Visual Studio
catalog_productPatchVersion: 14
catalog_productPreReleaseMilestoneSuffix: 1.0
catalog_productRelease: RTW
catalog_productSemanticVersion: 15.9.14+28307.770
catalog_requiredEngineVersion: 1.18.1049.33485
properties_campaignId: 112003091.1563535912
properties_channelManifestId: VisualStudio.15.Release/15.9.14+28307.770
properties_nickname:
properties_setupEngineFilePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe
instanceId: bcc9b5bf
installDate: 7/19/2019 5:00:06 AM
installationName: VisualStudio/16.1.6+29102.190
installationPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
installationVersion: 16.1.29102.190
productId: Microsoft.VisualStudio.Product.Community
productPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe
state: 4294967295
isComplete: 1
isLaunchable: 1
isPrerelease: 0
isRebootRequired: 0
displayName: Visual Studio Community 2019
description: Free, fully-featured IDE for students, open-source and individual developers
channelId: VisualStudio.16.Release
channelUri: https://aka.ms/vs/16/release/channel
enginePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service
releaseNotes: https://go.microsoft.com/fwlink/?LinkId=660893#16.1.6
thirdPartyNotices: https://go.microsoft.com/fwlink/?LinkId=660909
updateDate: 2019-07-19T12:00:06.2984029Z
catalog_buildBranch: d16.1
catalog_buildVersion: 16.1.29102.190
catalog_id: VisualStudio/16.1.6+29102.190
catalog_localBuild: build-lab
catalog_manifestName: VisualStudio
catalog_manifestType: installer
catalog_productDisplayVersion: 16.1.6
catalog_productLine: Dev16
catalog_productLineVersion: 2019
catalog_productMilestone: RTW
catalog_productMilestoneIsPreRelease: False
catalog_productName: Visual Studio
catalog_productPatchVersion: 6
catalog_productPreReleaseMilestoneSuffix: 1.0
catalog_productSemanticVersion: 16.1.6+29102.190
catalog_requiredEngineVersion: 2.1.3096.46871
properties_campaignId: 112003091.1563535912
properties_channelManifestId: VisualStudio.16.Release/16.1.6+29102.190
properties_nickname: 2
properties_setupEngineFilePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exelegacy products: 10, 11, 12, 14
Don't forget about legacy products. The part for this here:
(from newer to older versions:)
Lines 548 to 577 in 4b368c9
| :msbvsold {out:toolset} | |
| call :dbgprint "Searching from Visual Studio - 2015, 2013, ..." | |
| for %%v in (14.0, 12.0) do ( | |
| call :rtools %%v Y & if defined Y ( | |
| set %1=!Y! | |
| exit /B 0 | |
| ) | |
| ) | |
| call :dbgprint "-vs: not found" | |
| set "%1=" | |
| exit /B 0 | |
| :: :msbvsold | |
| :: - - - | |
| :: Tools from .NET Framework - .net 4.0, ... | |
| :msbnetf {out:toolset} | |
| call :dbgprint "Searching from .NET Framework - .NET 4.0, ..." | |
| for %%v in (4.0, 3.5, 2.0) do ( | |
| call :rtools %%v Y & if defined Y ( | |
| set %1=!Y! | |
| exit /B 0 | |
| ) | |
| ) | |
| call :dbgprint "-netfx: not found" | |
| set "%1=" | |
| exit /B 0 | |
| :: :msbnetf |
The Question is
Some additional processing from our side is possible for both cases above. But I don't think that's important for hMSBuild project because of minimal filter etc.
However, please comment and/or open PR for relevant changes.