From b9c712f26d921f7ffe0509d1cc45456680e8139f Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 22 Dec 2021 23:52:40 -0500 Subject: Version extension ids. https://github.com/wixtoolset/issues/issues/5933 - Add support for detecting VS2022. - Add x64 custom actions. - Remove ancient Help 2.0 support. - Update WixCop to add the new element to trigger custom action. --- src/ext/VisualStudio/ca/vsca.cpp | 81 ++++++++++++++++++++++++++++++++++++ src/ext/VisualStudio/ca/vsca.vcxproj | 8 ++++ 2 files changed, 89 insertions(+) (limited to 'src/ext/VisualStudio/ca') diff --git a/src/ext/VisualStudio/ca/vsca.cpp b/src/ext/VisualStudio/ca/vsca.cpp index 54a54a34..736add1f 100644 --- a/src/ext/VisualStudio/ca/vsca.cpp +++ b/src/ext/VisualStudio/ca/vsca.cpp @@ -53,6 +53,12 @@ static HRESULT ProcessVS2019( __in BOOL fComplete ); +static HRESULT ProcessVS2022( + __in_opt ISetupInstance* pInstance, + __in DWORD64 qwVersion, + __in BOOL fComplete + ); + static HRESULT SetPropertyForComponent( __in DWORD cComponents, __in VS_COMPONENT_PROPERTY* rgComponents, @@ -63,6 +69,7 @@ static VS_INSTANCE vrgInstances[] = { { FILEMAKEVERSION(15, 0, 0, 0), FILEMAKEVERSION(15, 0xffff, 0xffff, 0xffff), ProcessVS2017 }, { FILEMAKEVERSION(16, 0, 0, 0), FILEMAKEVERSION(16, 0xffff, 0xffff, 0xffff), ProcessVS2019 }, + { FILEMAKEVERSION(17, 0, 0, 0), FILEMAKEVERSION(17, 0xffff, 0xffff, 0xffff), ProcessVS2022 }, }; /****************************************************************** @@ -485,6 +492,80 @@ LExit: return hr; } +static HRESULT ProcessVS2022( + __in_opt ISetupInstance* pInstance, + __in DWORD64 qwVersion, + __in BOOL fComplete + ) +{ + static ISetupInstance* pLatest = NULL; + static DWORD64 qwLatest = 0; + + static LPCWSTR rgwzProducts[] = + { + L"Microsoft.VisualStudio.Product.Community", + L"Microsoft.VisualStudio.Product.Professional", + L"Microsoft.VisualStudio.Product.Enterprise", + }; + + // TODO: Consider making table-driven with these defaults per-version for easy customization. + static VS_COMPONENT_PROPERTY rgComponents[] = + { + { L"Microsoft.VisualStudio.Component.FSharp", L"VS2022_IDE_FSHARP_PROJECTSYSTEM_INSTALLED" }, + { L"Microsoft.VisualStudio.Component.Roslyn.LanguageServices", L"VS2022_IDE_VB_PROJECTSYSTEM_INSTALLED" }, + { L"Microsoft.VisualStudio.Component.Roslyn.LanguageServices", L"VS2022_IDE_VCSHARP_PROJECTSYSTEM_INSTALLED" }, + { L"Microsoft.VisualStudio.PackageGroup.TestTools.Core", L"VS2022_IDE_VSTS_TESTSYSTEM_INSTALLED" }, + { L"Microsoft.VisualStudio.Component.VC.CoreIde", L"VS2022_IDE_VC_PROJECTSYSTEM_INSTALLED" }, + { L"Microsoft.VisualStudio.Component.Web", L"VS2022_IDE_VWD_PROJECTSYSTEM_INSTALLED" }, + { L"Microsoft.VisualStudio.PackageGroup.DslRuntime", L"VS2022_IDE_MODELING_PROJECTSYSTEM_INSTALLED" }, + }; + + HRESULT hr = S_OK; + + if (fComplete) + { + if (pLatest) + { + hr = ProcessInstance(pLatest, L"VS2022_ROOT_FOLDER", countof(rgComponents), rgComponents); + ExitOnFailure(hr, "Failed to process VS2022 instance."); + } + } + else if (pInstance) + { + hr = InstanceInProducts(pInstance, countof(rgwzProducts), rgwzProducts); + ExitOnFailure(hr, "Failed to compare product IDs."); + + if (S_FALSE == hr) + { + ExitFunction(); + } + + hr = InstanceIsGreater(pLatest, qwLatest, pInstance, qwVersion); + ExitOnFailure(hr, "Failed to compare instances."); + + if (S_FALSE == hr) + { + ExitFunction(); + } + + ReleaseNullObject(pLatest); + + pLatest = pInstance; + qwLatest = qwVersion; + + // Caller will do a final Release() otherwise. + pLatest->AddRef(); + } + +LExit: + if (fComplete) + { + ReleaseObject(pLatest); + } + + return hr; +} + static HRESULT SetPropertyForComponent( __in DWORD cComponents, __in VS_COMPONENT_PROPERTY* rgComponents, diff --git a/src/ext/VisualStudio/ca/vsca.vcxproj b/src/ext/VisualStudio/ca/vsca.vcxproj index 8d6a3500..0b838b82 100644 --- a/src/ext/VisualStudio/ca/vsca.vcxproj +++ b/src/ext/VisualStudio/ca/vsca.vcxproj @@ -11,6 +11,14 @@ Release Win32 + + Debug + x64 + + + Release + x64 + -- cgit v1.2.3-55-g6feb