Skip to content

Commit 5fbccb7

Browse files
bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800) (GH-26802)
(cherry picked from commit 80190b3) Co-authored-by: Steve Dower <[email protected]> Co-authored-by: Steve Dower <[email protected]>
1 parent 8673b77 commit 5fbccb7

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
@@ -108,9 +108,18 @@
108108

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

0 commit comments

Comments
 (0)