Skip to content

Commit e7009f4

Browse files
bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800) (#26803)
(cherry picked from commit 80190b3) Co-authored-by: Steve Dower <[email protected]>
1 parent 6fb4248 commit e7009f4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improved error message when building without a Windows SDK installed.

PCbuild/python.props

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,18 @@
109109

110110
<!-- The minimum allowed SDK version to use for building -->
111111
<DefaultWindowsSDKVersion>10.0.10586.0</DefaultWindowsSDKVersion>
112-
<DefaultWindowsSDKVersion Condition="$([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
112+
<DefaultWindowsSDKVersion Condition="$(_RegistryVersion) != '' and $([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
113113
</PropertyGroup>
114-
114+
115+
<Target Name="_CheckWindowsSDKFound" BeforeTargets="_CheckWindowsSDKInstalled" Condition="$(_RegistryVersion) == ''">
116+
<PropertyGroup>
117+
<_Message>Failed to locate a Windows SDK installation.</_Message>
118+
<_Message>$(_Message) If the build fails, please use the Visual Studio Installer to install the Windows SDK.</_Message>
119+
<_Message>$(_Message) (Ignore the version number specified in the error message and select the latest.)</_Message>
120+
</PropertyGroup>
121+
<Warning Text="$(_Message)" />
122+
</Target>
123+
115124
<PropertyGroup Condition="$(WindowsTargetPlatformVersion) == ''">
116125
<WindowsTargetPlatformVersion>$(DefaultWindowsSDKVersion)</WindowsTargetPlatformVersion>
117126
</PropertyGroup>
@@ -176,7 +185,7 @@
176185
<ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
177186
<ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
178187
</PropertyGroup>
179-
188+
180189
<PropertyGroup>
181190
<PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
182191
<PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>

0 commit comments

Comments
 (0)