diff --git a/src/chm/documents/customactions/wixvsextension.html.md b/src/chm/documents/customactions/wixvsextension.html.md index 136fec5e5..995ad2ca2 100644 --- a/src/chm/documents/customactions/wixvsextension.html.md +++ b/src/chm/documents/customactions/wixvsextension.html.md @@ -17,6 +17,7 @@ The [WixVSExtension](~/xsd/vs/index.html) includes a set of custom actions to ma * [Visual Studio 2015](#vs2015properties) * [Visual Studio 2017](#vs2017properties) * [Visual Studio 2019](#vs2019properties) + * [Visual Studio 2022](#vs2022properties) * [Custom Actions](#allcustomactions) ## Properties @@ -1237,7 +1238,7 @@ Here is a complete list of properties for the **Visua -Here is a complete list of properties for the **Visual Studio 2019** product family: +Here is a complete list of properties for the **Visual Studio 2019** product family: @@ -1370,6 +1371,138 @@ Here is a complete list of properties for the **Visua
+Here is a complete list of properties for the **Visual Studio 2022** product family: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Property name

+
+

Meaning

+
+

VS2022DEVENV

+
+

Full path to devenv.exe for Visual Studio 2022 if it is installed on the system. This property is available starting with WiX v3.14.

+
+

VS2022_EXTENSIONS_DIR

+
+

Full path to the Visual Studio 2022 extensions directory. This property is available starting with WiX v3.14.

+
+

VS2022_ITEMTEMPLATES_DIR

+
+

Full path to the Visual Studio 2022 item templates directory. This property is available starting with WiX v3.14.

+
+

VS2022_PROJECTTEMPLATES_DIR

+
+

Full path to the Visual Studio 2022 project templates directory. This property is available starting with WiX v3.14.

+
+

VS2022_SCHEMAS_DIR

+
+

Full path to the Visual Studio 2022 XML schemas directory. This property is available starting with WiX v3.14.

+
+

VS2022_ROOT_FOLDER

+
+

Full path to the Visual Studio 2022 root installation directory. This property is available starting with WiX v3.14.

+
+

VS2022_IDE_DIR

+
+

Full path to the Visual Studio 2022 directory containing devenv.exe. This property is available starting with WiX v3.14.

+
+

VS2022_IDE_VB_PROJECTSYSTEM_INSTALLED

+
+

Indicates whether Visual Studio 2022 Professional Edition or higher is installed and the Visual Basic project system is installed for it. This property is available starting with WiX v3.14.

+
+

VS2022_IDE_VC_PROJECTSYSTEM_INSTALLED

+
+

Indicates whether Visual Studio 2022 Professional Edition or higher is installed and the Visual C++ project system is installed for it. This property is available starting with WiX v3.14.

+
+

VS2022_IDE_VCSHARP_PROJECTSYSTEM_INSTALLED

+
+

Indicates whether Visual Studio 2022 Professional Edition or higher is installed and the Visual C# project system is installed for it. This property is available starting with WiX v3.14.

+
+

VS2022_IDE_VWD_PROJECTSYSTEM_INSTALLED

+
+

Indicates whether Visual Studio 2022 Professional Edition or higher is installed and the Visual Web Developer project system is installed for it. This property is available starting with WiX v3.14.

+
+

VS2022_IDE_VSTS_TESTSYSTEM_INSTALLED

+
+

Indicates whether or not the Visual Studio 2022 Team Test project system is installed on the system. This property is available starting with WiX v3.14.

+
+

VS2022_IDE_MODELING_PROJECTSYSTEM_INSTALLED

+
+

Indicates whether or not the Visual Studio 2022 Modeling project system is installed on the system. This property is available starting with WiX v3.14.

+
+

VS2022_IDE_FSHARP_PROJECTSYSTEM_INSTALLED

+
+

Indicates whether or not the Visual Studio 2022 F# project system is installed on the system. This property is available starting with WiX v3.14.

+
+

VS2022_BOOTSTRAPPER_PACKAGE_FOLDER

+
+

The location of the Visual Studio 2022 bootstrapper package folder. This property is available starting with WiX v3.14.

+
## Custom Actions Here is a complete list of custom actions: @@ -1855,6 +1988,22 @@ Here is a complete list of custom actions:

Runs devenv.exe /InstallVSTemplates if Visual Studio 2019 Community Edition or higher is found on the system. Including this custom action automatically adds the VS2019DEVENV property. This custom action is available starting with WiX v3.14.

+ + +

VS2022Setup

+ + +

Runs devenv.exe /setup if Visual Studio 2022 Community Edition or higher is found on the system. Including this custom action automatically adds the VS2022DEVENV property. This custom action is available starting with WiX v3.14.

+ + + + +

VS2022InstallVSTemplates

+ + +

Runs devenv.exe /InstallVSTemplates if Visual Studio 2022 Community Edition or higher is found on the system. Including this custom action automatically adds the VS2022DEVENV property. This custom action is available starting with WiX v3.14.

+ + ## Using WixVSExtension Properties or Custom Actions diff --git a/src/ext/VSExtension/ca/vsca.cpp b/src/ext/VSExtension/ca/vsca.cpp index 54a54a347..d246c3247 100644 --- a/src/ext/VSExtension/ca/vsca.cpp +++ b/src/ext/VSExtension/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 @@ static HRESULT ProcessVS2019( 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/VSExtension/wixlib/VS2022.wxs b/src/ext/VSExtension/wixlib/VS2022.wxs new file mode 100644 index 000000000..d5c40bba5 --- /dev/null +++ b/src/ext/VSExtension/wixlib/VS2022.wxs @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VS2022DEVENV + + + + + + + + + VS2022DEVENV + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/VSExtension/wixlib/VSExtension.wixproj b/src/ext/VSExtension/wixlib/VSExtension.wixproj index 9615a2ec8..6d7916897 100644 --- a/src/ext/VSExtension/wixlib/VSExtension.wixproj +++ b/src/ext/VSExtension/wixlib/VSExtension.wixproj @@ -25,6 +25,7 @@ +