Error whilst trying to build from source

I have run setup.bat, and GenerateProjectFiles.bat -2017 but now i cannot build the engine,

The error is as follows

14>------ Rebuild All started: Project: TestPAL, Configuration: Development_Program x64 ------
14>Object reference not set to an instance of an object.
14>Error: Object reference not set to an instance of an object.
15>------ Rebuild All started: Project: UnrealCEFSubProcess, Configuration: Development_Program x64 ------
15>Object reference not set to an instance of an object.
15>Error: Object reference not set to an instance of an object.
16>------ Rebuild All started: Project: UnrealFileServer, Configuration: Development_Program x64 ------
16>Object reference not set to an instance of an object.
16>Error: Object reference not set to an instance of an object.
17>------ Rebuild All started: Project: UnrealFrontend, Configuration: Development_Program x64 ------
17>Object reference not set to an instance of an object.
17>Error: Object reference not set to an instance of an object.
18>------ Rebuild All started: Project: UnrealHeaderTool, Configuration: Development_Program x64 ------
18>Object reference not set to an instance of an object.
18>Error: Object reference not set to an instance of an object.
19>------ Rebuild All started: Project: UnrealPak, Configuration: Development_Program x64 ------
19>Object reference not set to an instance of an object.
19>Error: Object reference not set to an instance of an object.
20>------ Rebuild All started: Project: UnrealVersionSelector, Configuration: Development_Program x64 ------
20>Object reference not set to an instance of an object.
20>Error: Object reference not set to an instance of an object.
21>------ Rebuild All started: Project: UnrealWatchdog, Configuration: Development_Program x64 ------
21>Object reference not set to an instance of an object.
21>Error: Object reference not set to an instance of an object.
22>------ Rebuild All started: Project: BootstrapPackagedGame, Configuration: Development_Program x64 ------
22>Object reference not set to an instance of an object.
22>Error: Object reference not set to an instance of an object.
23>------ Rebuild All started: Project: ShaderCompileWorker, Configuration: Development_Program x64 ------
23>Object reference not set to an instance of an object.
23>Error: Object reference not set to an instance of an object.
24>------ Skipped Rebuild All: Project: DsymExporter, Configuration: Invalid Win32 ------
24>Project not selected to build for this solution configuration
25>------ Rebuild All started: Project: BlankProgram, Configuration: Development_Program x64 ------
25>Object reference not set to an instance of an object.
25>Error: Object reference not set to an instance of an object.
26>------ Rebuild All started: Project: BuildPatchTool, Configuration: Development_Program x64 ------
26>Object reference not set to an instance of an object.
26>Error: Object reference not set to an instance of an object.
27>------ Rebuild All started: Project: CrashReportClient, Configuration: Development_Program x64 ------
27>Object reference not set to an instance of an object.
27>Error: Object reference not set to an instance of an object.
28>------ Skipped Rebuild All: Project: UnrealLaunchDaemon, Configuration: Invalid Win32 ------
28>Project not selected to build for this solution configuration
29>------ Skipped Rebuild All: Project: UE4EditorServices, Configuration: Invalid Win32 ------
29>Project not selected to build for this solution configuration
30>------ Skipped Rebuild All: Project: UnrealAtoS, Configuration: Invalid Win32 ------
30>Project not selected to build for this solution configuration
31>------ Skipped Rebuild All: Project: MayaLiveLinkPlugin2016, Configuration: Development_Program x64 ------
31>Project not selected to build for this solution configuration
32>------ Skipped Rebuild All: Project: MayaLiveLinkPlugin2017, Configuration: Development_Program x64 ------
32>Project not selected to build for this solution configuration
33>------ Skipped Rebuild All: Project: MayaLiveLinkPlugin2018, Configuration: Development_Program x64 ------
33>Project not selected to build for this solution configuration
34>------ Rebuild All started: Project: MinidumpDiagnostics, Configuration: Development_Program x64 ------
34>Object reference not set to an instance of an object.
34>Error: Object reference not set to an instance of an object.
35>------ Rebuild All started: Project: SlateViewer, Configuration: Development_Program x64 ------
35>Object reference not set to an instance of an object.
35>Error: Object reference not set to an instance of an object.
36>------ Rebuild All started: Project: UnrealLightmass, Configuration: Development_Program x64 ------
36>Object reference not set to an instance of an object.
36>Error: Object reference not set to an instance of an object.
37>------ Rebuild All started: Project: SymbolDebugger, Configuration: Development_Program x64 ------
37>Object reference not set to an instance of an object.
37>Error: Object reference not set to an instance of an object.
========== Rebuild All: 29 succeeded, 17 failed, 7 skipped ==========

Any ideas what the error actually is.

Cutting down the build For instance Building the ShaderCompileWorker only shows this in the Build Log
1>------ Rebuild All started: Project: DotNETUtilities, Configuration: Development Any CPU ------
1> DotNETUtilities → C:\development\UnrealEngine\Engine\Binaries\DotNET\DotNETUtilities.dll
2>------ Rebuild All started: Project: UnrealBuildTool, Configuration: Development Any CPU ------
2> UnrealBuildTool → C:\development\UnrealEngine\Engine\Binaries\DotNET\UnrealBuildTool.exe
3>------ Rebuild All started: Project: ShaderCompileWorker, Configuration: Development_Program x64 ------
3>Object reference not set to an instance of an object.
========== Rebuild All: 2 succeeded, 1 failed, 0 skipped ==========

Could it be something about some execution rule on the domain stopping the external tools from running, is there any way for me to test it.

Never seen this, it looks like a C# error and I’m not familiar with C#.

A bit of a shot in the dark, but my feeling is, you are maybe missing some requirements when installing visual studio, maybe not the right version?
Maybe not all the C# tools?

Other thing you can do is “git clean -f -x” in the repository directory, make sure you’re on the head end of a a remote branch like 4.21 (make sure you’re not on some dev revision). If you’re using tortoise git you have the “Clean Up” command.

I have tried reinstalling everything, including VS2017, and redownloading the Engine.
Now, I have found that i can compile fine from the command line but I cannot find the command to actually compile the Editor and what folder i need to be in.

Build\BatchFiles\Build.bat ??? Win64 DevelopmentEditor -WaitMutex -FromMsBuild -2017

What folder should i be running this command in and what should be in the location marked by ???

Just to make the answer a little more official, writing it up here.

Regarding the first question, it would seem the problem was during visual studio install not all required C# tools were installed.

Regarding build commands, I would recommend using Visual Studio as described here, at least as a start:

You should have everything you need from Visual Studio.

If you need to be doing something special:

Build.bat works this way:
\Path\To\BatchFiles\Build.bat “Target” Win64 Development -WaitMutex -FromMsBuild

where “Target” = UE4Editor when you want to build the engine.

Example:
\Path\To\BatchFiles\Build.bat UE4Editor Win64 Development -WaitMutex -FromMsBuild

You can also use it to build you’re game editor:
\Path\To\BatchFiles\Build.bat "gamename"Editor Win64 Development “projectpath” -WaitMutex -FromMsBuild

where “gamename” is the name of you’re project, ad project path, a path to you’re uproject file.

example:
\Path\To\BatchFiles\Build.bat MyGameEditor Win64 Development \Path\To\My\Project\MyGame.uproject -WaitMutex -FromMsBuild

(regarding -2017 pretty sure you don’t need this one, this would be used in the case where you want to use a different version of vs then recommended for ue version)

Hope this helps.

All possible tools had been installed as i think was shown by the fact that the bat build worked perfectly. Thanks for the build command that is exactly what I was looking for, Just loading up (hopefully) the Editor for the actual project, and if it works then it will be proof that the engine compiled correctly after all - its currently recompiling some plugins for the new engine, It may be that because the “Default” project type on VS was set to VB/C# rather than C++ may be the issue in the engine compilation.