Skip to content

Commit

Permalink
VS2022 support
Browse files Browse the repository at this point in the history
  • Loading branch information
barnson committed Mar 20, 2022
1 parent b496a8f commit 9871b10
Show file tree
Hide file tree
Showing 4 changed files with 375 additions and 1 deletion.
151 changes: 150 additions & 1 deletion src/chm/documents/customactions/wixvsextension.html.md
Expand Up @@ -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)

## <a name="allproperties"></a> Properties
Expand Down Expand Up @@ -1237,7 +1238,7 @@ Here is a complete list of properties for the <a name="vs2017properties">**Visua
</tr>
</table>

Here is a complete list of properties for the <a name="VS2019properties">**Visual Studio 2019**</a> product family:
Here is a complete list of properties for the <a name="vs2019properties">**Visual Studio 2019**</a> product family:

<table cellspacing="0" cellpadding="4" class="style1" border="1">
<tr>
Expand Down Expand Up @@ -1370,6 +1371,138 @@ Here is a complete list of properties for the <a name="VS2019properties">**Visua
</tr>
</table>

Here is a complete list of properties for the <a name="vs2022properties">**Visual Studio 2022**</a> product family:

<table cellspacing="0" cellpadding="4" class="style1" border="1">
<tr>
<td valign="top">
<p><b>Property name</b></p>
</td>
<td valign="top">
<p><b>Meaning</b></p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022DEVENV</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_EXTENSIONS_DIR</p>
</td>
<td>
<p>Full path to the Visual Studio 2022 extensions directory. This property is available starting with WiX v3.14.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_ITEMTEMPLATES_DIR</p>
</td>
<td>
<p>Full path to the Visual Studio 2022 item templates directory. This property is available starting with WiX v3.14.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_PROJECTTEMPLATES_DIR</p>
</td>
<td>
<p>Full path to the Visual Studio 2022 project templates directory. This property is available starting with WiX v3.14.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_SCHEMAS_DIR</p>
</td>
<td>
<p>Full path to the Visual Studio 2022 XML schemas directory. This property is available starting with WiX v3.14.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_ROOT_FOLDER</p>
</td>
<td>
<p>Full path to the Visual Studio 2022 root installation directory. This property is available starting with WiX v3.14.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_IDE_DIR</p>
</td>
<td>
<p>Full path to the Visual Studio 2022 directory containing devenv.exe. This property is available starting with WiX v3.14.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_IDE_VB_PROJECTSYSTEM_INSTALLED</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_IDE_VC_PROJECTSYSTEM_INSTALLED</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_IDE_VCSHARP_PROJECTSYSTEM_INSTALLED</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_IDE_VWD_PROJECTSYSTEM_INSTALLED</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_IDE_VSTS_TESTSYSTEM_INSTALLED</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_IDE_MODELING_PROJECTSYSTEM_INSTALLED</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_IDE_FSHARP_PROJECTSYSTEM_INSTALLED</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022_BOOTSTRAPPER_PACKAGE_FOLDER</p>
</td>
<td>
<p>The location of the Visual Studio 2022 bootstrapper package folder. This property is available starting with WiX v3.14.</p>
</td>
</tr>
</table>
## <a name="allcustomactions"></a> Custom Actions

Here is a complete list of custom actions:
Expand Down Expand Up @@ -1855,6 +1988,22 @@ Here is a complete list of custom actions:
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022Setup</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td valign="top">
<p>VS2022InstallVSTemplates</p>
</td>
<td>
<p>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.</p>
</td>
</tr>
</table>

## Using WixVSExtension Properties or Custom Actions
Expand Down
81 changes: 81 additions & 0 deletions src/ext/VSExtension/ca/vsca.cpp
Expand Up @@ -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,
Expand All @@ -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 },
};

/******************************************************************
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9871b10

Please sign in to comment.