Building UE4 from source [error MSB3073 The command "..\..\Build\BatchFiles\Build.bat DatasmithSDK ...." exited with code 6

The short answer

I was silly enough to put the source code of my Unreal Engine under a path name containing a space character:

 C:\UnrealEngine 4.25\Engine\

Obviously that’s never a good idea. You can either avoid spaces and rebuild the whole solution or you have to patch DatasmithSDK.Target.cs as follows:

//C:\UE\Engine\Source\Programs\Enterprise\Datasmith\DatasmithSDK\DatasmithSDK.Target.cs
public void AddWindowsPostBuildSteps()
{
	// Copy the documentation
	string SrcPath = @"""$(EngineDir)\Source\Programs\Enterprise\Datasmith\DatasmithSDK\Documentation\*.*""";
	string DestPath = @"""$(EngineDir)\Binaries\$(TargetPlatform)\DatasmithSDK\Documentation\""";

	PostBuildSteps.Add(string.Format("echo Copying {0} to {1}", SrcPath, DestPath));
	PostBuildSteps.Add(string.Format("xcopy {0} {1} /R /Y /S", SrcPath, DestPath));

	// Copy the header files
	SrcPath = @"""$(EngineDir)\Source\Runtime\Datasmith\DatasmithCore\Public\*.h""";
	DestPath = @"""$(EngineDir)\Binaries\$(TargetPlatform)\DatasmithSDK\Public\""";

	PostBuildSteps.Add(string.Format("echo Copying {0} to {1}", SrcPath, DestPath));
	PostBuildSteps.Add(string.Format("xcopy {0} {1} /R /Y /S", SrcPath, DestPath));

	SrcPath = @"""$(EngineDir)\Source\Developer\Datasmith\DatasmithExporter\Public\*.h""";
	DestPath = @"""$(EngineDir)\Binaries\$(TargetPlatform)\DatasmithSDK\Public\""";

	PostBuildSteps.Add(string.Format("echo Copying {0} to {1}", SrcPath, DestPath));
	PostBuildSteps.Add(string.Format("xcopy {0} {1} /R /Y /S", SrcPath, DestPath));
}

Here I’m merely adding “” at the beginning and end of the strings SrcPath DestPath for this build script to handle path with spaces.

1 Like