VC++ directories not set on start - causing 2 errors

Did you apply those changes as patches or just download the entire latest .cs file? I think you have a mix of old and new changes… none of the patches I listed above refer to ShouldBuildByDefaultForSolutionTargets.

Try applying the patches individually, or getting the entire of the latest UnrealBuildTool source.


Hi trutty,

I think you have the same problem with old and new code as sivan above… please follow up with more info there.


1st copied stuff from 1st 3 links to new files and updated utils.cs line by line, but the 3rd one seemed to me containing all the previous 2 ones, so when the 4th link appeared, I copied from github view/raw the whole files… okay, back to backups again…

Alright, one step closer. Copying the entire UnrealBuildTool folder from the master branch, I now can compile UBT without errors. When trying to launch (or Clean) the Editor I get the following errors

These are more of the same type of problem. I think you may have to sync all of the tool source in order to continue, or just roll back your source to the last working version and apply the patches above individually.



if I get UBT from master-branch, I get this:
Warning 1 The project ‘EnvVarsToXML’ cannot be referenced.
but UBT compilation succeeds. but get the attached error message on creating a new basic code project.

maybe I do something stupid, but probably a step-by-step list would help us… (to exactly know what to and what not to do) I’m not professional in VS and C++ at all, mainly used a C-like script language so far…

Something has changed in the build process meaning that those functions

It’s hard for me to suggest a series of steps since I’m not part of the GitHub source distribution process and I can’t say what will be needed, nor do I know what the state your engine source code is.

However, I no longer suggest the patch method. Instead, I suggest that you get all latest code from GitHub, rather than just the UBT source. That way, all the source should be in sync and you shouldn’t have some tools in one state and other tools in another state. Then try building UBT and running as usual.

Let me know how it goes.


The master branch compilation failed yesterday, I will try it again after my holiday. By the way, 4.7 engine compilation takes double time than 4.4 did here, and it decreases my motivation to do it too often. Maybe it is related to my pc (nothing changed), or switching from VS2013EE to Community (but in general it seems to be faster).

Until it is resolved perfectly, it would be really practical to put a compile checkbox in add-new-class wizard window, because it also fails with an error message, and class addition seems to be failing (over the name a message bar appears saying a class with similar name already exists), but after closing the messagebox, the wizards, and the editor, and updating project in VS, the new classes are there.

the promoted branch fails to generate project files too.

Fails how? As we do not see the problems you see, we need explicit details on what exactly you see every time.

The engine goes through an extensive testing cycle before promotion and would not have been promoted if we could repeat your issue internally.


today morning downloaded promoted branch and ran setup.bat, then ran GenerateProjectFiles.bat, and:

(I think I got similar error after made changes discussed above) I really hope it can be resolved as it would mean I cannot use the engine source…

(right click to show picture in larger size)

Can you repost that output but scrolled up to show the top part of the error, please?

ahh sorry, here is the full one:

Ok, this appears that the XML file is empty. This is likely to be because the EnvVarsToXML.exe file either doesn’t exist or failed to execute for some reason.

Have you definitely got a built and working EnvVarsToXML.exe in your Engine/Binaries/DotNET folder? Can you run it from a command line and check that it produces output, e.g.:

EnvVarsToXML env.xml

Next, open up your %TEMP% folder and sort by date. The latest files should include a tmp1234.tmp.bat (but with some other random number) file and another with the same name without the .bat extension. I’m guessing that the .tmp file is missing or empty (please confirm), and that the .tmp.bat has not run correctly for some reason.

Please post the .tmp.bat file here for analysis.


EnvVarsToXML.exe exists in the DotNET folder, but produces no xml file

yes, tmp8263.tmp is empty, maybe because the .bat file contains special characters (due to my user name):

call “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools…/…/VC/bin/x86_amd64/vcvarsx86_amd64.bat”
“C:\UE4\UE473p\Engine\Binaries\DotNET\EnvVarsToXML.exe” “C:\Users\Iván\AppData\Local\Temp\tmp8263.tmp”

If you run the .bat file directly, does it still fail to produce a non-empty file?

If you replace the batch file with the following (making sure it’s written out as an ASCII file), does it work?

call “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools…/…/VC/bin/x86_amd64/vcvarsx86_amd64.bat” “C:\UE4\UE473p\Engine\Binaries\DotNET\EnvVarsToXML.exe” “%TEMP%\tmp8263.tmp”

if I run the tnp…bat by clicking on it, it stops with an unhandled exception

with the modified content not even an empty tmp file produced.

I copied it to another location and modified the content as the following but no output tmp file:

call “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools…/…/VC/bin/x86_amd64/vcvarsx86_amd64.bat” “C:\UE4\UE473p\Engine\Binaries\DotNET\EnvVarsToXML.exe” “C:\UE4\000\tmp8263.tmp”


You can see from your screenshot that the path has been corrupted by the batch file. Your username and also the ‘call’ program has not been run correctly because of non-ASCII characters on the prefix.

This is because the batch file has been written out as Unicode due to the presence of non-ASCII characters. When you modify the content, you need to ensure that the encoding type is ANSI, not Unicode. If you are using Notepad, you have that option on the Save As dialog, as seen here:

I have another solution to avoiding this problem which I’m currently testing.