Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 47e3e38

Browse files
committed
Add documentation on how to block installation based on OS & VCREDIST versions
Attempt on addressing wixtoolset/issues#8785 and wixtoolset/issues#8786 by extending the WiX documentation to also cover these to checks that I believe are quite common.
1 parent 8c278f6 commit 47e3e38

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
sidebar_position: 91
3+
---
4+
5+
# How To: Block installation based on OS version
6+
7+
It is often desirable to block installation of an application on too old Windows versions. The following sample demonstrates how to block installation on Windows versions prior to Windows 10 version 21H1.
8+
9+
```xml
10+
<Property Id="WINDOWSBUILDNUMBER" Secure="yes">
11+
<RegistrySearch Id="BuildNumberSearch" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Name="CurrentBuildNumber" Type="raw" />
12+
</Property>
13+
<Condition Message="This application is only supported on Windows 10 version 21H1 (build 19044) or higher.">
14+
<![CDATA[(WINDOWSBUILDNUMBER >= 19044)]]>
15+
</Condition>
16+
```
17+
18+
The sample uses the `SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber` registry key to detect the current Windows version.
19+
20+
21+
# How To: Block installation on missing or too old VCREDIST
22+
23+
It is sometimes desirable to block installation of an application if the Microsoft Visual C++ Redistributable is either missing or too old. The following sample demonstrates how block installation if the Microsoft Visual C++ 2015-2022 (x64) Redistributable is either missing or predates the 17.2 version.
24+
25+
```xml
26+
<!-- Minimum version obtained by downloading "Visual C++ Redistributable for Visual Studio 2022" (x64) 17.2 from https://my.visualstudio.com/Downloads and checking the EXE file version. -->
27+
<Upgrade Id="36F68A90-239C-34DF-B58C-64B30153CE35">
28+
<UpgradeVersion OnlyDetect="yes" Property="VCREDIST_X64" Minimum="14.32.31332.0" />
29+
</Upgrade>
30+
<Launch Condition="Installed OR VCREDIST_X64" Message="Microsoft Visual C++ 2015-2022 (x64) Redistributable missing or too old." />
31+
</Condition>
32+
```

0 commit comments

Comments
 (0)