Error packaging HoloLens2 project when adding WinRT

I am trying to add WinRT so I can get access to those capabilities (e.g., saving files on the HoloLens2). My project packages and runs great on the PC and HL2. However, when I add the lines for the “Build.cs” file specified in the documentation the project runs fine on the PC and connected to the HL2 but the packaging fails at the following step:

  • [1/9] SharedPCH.Engine.Exceptions.ShadowErrors.Cpp17.cpp.

The generated log files are shown below.
Log.txt (25.1 KB)
UBT-viper_ar_hololensGame-HoloLens-Shipping.txt (28.6 KB)

Note: At this stage I am not trying to save to the HL2. I’m just step-by-step trying to get to the point where I can do that.

I really have no idea where to go from here so I cast my lure into the murky depths of the forum. Thanks for any help you may be able to provide.

Things I’ve tried:

  • [SOLVED] fatal error C1853 on Plugin Packaging only - #16 by erol_demirci
    • “Deleting Build, Intermediate, Saved and Visual Studio .sln file then rebuilding”
    • Delete “\UE_4.26\Engine\Intermediate\Build\Win64\UE4Editor\Development\Engine\SharedPCH.Engine.h.pch”… this file didn’t exist in that location nor, it seems, on my computer at all… Is this the issue??? Did find some other *.pch files in Intermediate folder but those did get deleted already.
    • Moving project from Documents folder… My project is not in that folder.
    • Removed Windows 10 SDK (10.0.18362.0) using VS Installer - the 10.0.19041.0 was still installed. Then deleted Build, Intermediate, Saved and Visual Studio .sln file then rebuilt. Then went to Project Settings>Platform>HoloLens>Toolchain>Windows 10 SDK Version and selected 10.0.19041.0. Still failing :frowning: .

After some communication with Microsoft, there appears that the issue may be something related to Visual Studio. The following commit was found on the UE4 repo and may be a work around:
Fix compilation error when using C++17 due to workaround for Visual S… · EpicGames/UnrealEngine@b69d5dc (

To test I grabbed 4.27 Preview 2 and rebuilt my project. The packaging step now proceeds past the error above :grinning_face_with_smiling_eyes: … but… now UXTools may be causing things to fail… :frowning: … so not fixed but progress… stay tuned…