Skip to content

Commit 5c3ba00

Browse files
committed
Install Windows SDK >= 18362 when using VS2019 to fix compilation of UE-4.27.0
resolves #192
1 parent 9bd34d9 commit 5c3ba00

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

ue4docker/dockerfiles/ue4-build-prerequisites/windows/install-prerequisites.bat

+24-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,29 @@ powershell -Command "Copy-Item -Path \"*\x64\vulkan-1.dll\" -Destination C:\Wind
3333

3434
set VISUAL_STUDIO_BUILD_NUMBER=%~1
3535

36+
@rem Use the latest available Windows SDK. The motivation behind this is:
37+
@rem 1. Newer SDKs allow developers to use newer APIs. Developers can guard that API usage with runtime version checks if they want to continue to support older Windows releases.
38+
@rem 2. Unreal Engine slowly moves to newer Windows SDK. 4.27.0 no longer compiles with SDKs older than 18362 and even if it will be fixed in 4.27.x,
39+
@rem this is just a question of a time when older SDKs support will be dropped completely
40+
@rem 3. UE5 doesn't support VS2017 at all, so in the future that argument for continuing to use Windows SDK 17763 from VS2017 era will be weaker and weaker.
41+
@rem
42+
@rem We can't use newer SDK for VS2017 that is used to compile older engines because 18362 SDK support was only added in UE-4.23.
43+
@rem
44+
@rem See https://github.com/adamrehn/ue4-docker/issues/192
45+
@rem See https://forums.unrealengine.com/t/ndis_miniport_major_version-is-not-defined-error/135058
46+
@rem See https://github.com/EpicGames/UnrealEngine/blame/4.23.0-release/Engine/Source/Programs/UnrealBuildTool/Platform/Windows/UEBuildWindows.cs#L1822-L1823
47+
@rem See https://github.com/EpicGames/UnrealEngine/commit/ecc4872c3269e75a24adc40734cc8bcc9bbed1ca
48+
@rem See https://udn.unrealengine.com/s/question/0D54z000079HcjJCAS/d3d12h427-error-c4668-winapipartitiongames-is-not-defined-as-a-preprocessor-macro-replacing-with-0-for-ifelif
49+
@rem
50+
@rem Keywords for Google:
51+
@rem error C4668: 'NDIS_MINIPORT_MAJOR_VERSION' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif
52+
@rem d3d12.h(427): error C4668: 'WINAPI_PARTITION_GAMES' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
53+
if "%VISUAL_STUDIO_BUILD_NUMBER%" == "15" (
54+
set WINDOWS_SDK_VERSION=17763
55+
) else (
56+
set WINDOWS_SDK_VERSION=20348
57+
)
58+
3659
@rem Install the Visual Studio Build Tools workloads and components we need
3760
@rem NOTE: We use the Visual Studio 2019 installer even for Visual Studio 2017 here because the old installer now breaks
3861
@rem NOTE: VS2019 Build Tools doesn't have 4.6.2 .NET SDK and what actually gets installed is 4.8
@@ -49,7 +72,7 @@ curl --progress-bar -L "https://aka.ms/vs/16/release/vs_buildtools.exe" --output
4972
--add Microsoft.VisualStudio.Workload.MSBuildTools ^
5073
--add Microsoft.VisualStudio.Component.NuGet ^
5174
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^
52-
--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ^
75+
--add Microsoft.VisualStudio.Component.Windows10SDK.%WINDOWS_SDK_VERSION% ^
5376
--add Microsoft.Net.Component.4.5.TargetingPack ^
5477
--add Microsoft.Net.ComponentGroup.4.6.2.DeveloperTools ^
5578
--add Microsoft.NetCore.Component.SDK

0 commit comments

Comments
 (0)