Cannot build Shipping configuration

I can build my project successfully with all the DebugGame and Development configurations (Visual Studio 2015, Win64). But in Shipping configuration, I get the following log:

1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Build started: Project: MyProject2, Configuration: Shipping_Game x64 ------
2>  Parsing headers for MyProject2
2>    Running UnrealHeaderTool "D:\Unreal\MyProject2\MyProject2.uproject" "D:\Unreal\MyProject2\Intermediate\Build\Win64\MyProject2\Shipping\UnrealHeaderTool.manifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -rocket -installed
2>  Reflection code generated for MyProject2 in 3.6568719 seconds
2>  Performing 6 actions (4 in parallel)
2>  PCH.UdpMotionSenderPrivatePCH.h.cpp
2>c1xx : fatal error C1083: Cannot open source file: 'D:\Unreal\MyProject2\Plugins\UdpMotionSender\Intermediate\Build\Win64\UE4\Shipping\UdpMotionSender\PCH.UdpMotionSenderPrivatePCH.h.cpp': No such file or directory
2>  -------- End Detailed Actions Stats -----------------------------------------------------------
2>ERROR : UBT error : Failed to produce item: D:\Unreal\MyProject2\Plugins\UdpMotionSender\Binaries\Win64\UE4-UdpMotionSender-Win64-Shipping.lib
2>  Total build time: 5.14 seconds
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3073: The command ""C:\Program Files (x86)\Epic Games\4.10\Engine\Build\BatchFiles\Build.bat" MyProject2 Win64 Shipping "D:\Unreal\MyProject2\MyProject2.uproject" -rocket -waitmutex -2015" exited with code -1.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Something seems to be wrong with the precompiled headers. What could be the problem here?

Turns out the following steps help:

  1. Close Visual Studio
  2. Refresh Visual Studio Project
  3. Open Visual Studio
  4. Clean Solution
  5. Rebuild it