GenerateProjectFiles.bat stuck on 'Writing project files...'

Hi guys,

I appreciate there’s quite a few topics about the GenerateProjectFiles.bat and generating the VS .sln files. However, I have tried a lot of different thing to make it work without any effect.

My setup

  • I am running SP1 with a
    fresh install of Visual Studio 2013.
    VS2013.
  • My C drive is a small SSD and
    my A drive is my storage where VS2013
    and Unreal Engine (UE) are kept.

What I’ve done…

  1. I cloned a copy of Unreal Engine (UE) repo from Github,
  2. I downloaded the dependencies using Setup.bat

The problem

When I run GenerateProjectFiles.bat (running as administrator), it gets stuck on ‘Writing project files…’

56382-ue_issue.png

I have checked the tmp file that this process generates in my AppData folder and it is empty.

What I’ve tried to resolve the issue

  • I have checked VS2013

Visual Studio 2013 is installed at A:\APPLICATIONS\VisualStudio. My environment variable VS120COMNTOOLS is correctly pointing to A:\APPLICATIONS\VisualStudio\Common7\Tools. There are no special/odd characters in the file paths that could confuse the program, there are also no “” wrapped around the file paths.

I have added A:\APPLICATIONS\VisualStudio\Common7\Tools\ to my Path variables too, just to be thorough. No effect.

There was an old environment variable pointing to an uninstalled copy of Visual Studio 2012, which I removed in case of potential conflicts but that did nothing.

I have checked my registry set up for Visual Studio and InstallDir is correctly pointing to A:\APPLICATIONS\VisualStudio\Common7\IDE\ (again, without any “” wrapped around the file path).

I have also wrote, built and ran a small program in Visual Studio to make sure that was all working, which it is.

  • I have checked more environment variables

I have added the System32 to my Path variables. It wasn’t present before but adding it had no effect.

I’ve made sure .NET and MSBuild are in my Path variables. They weren’t originally but after adding them (and testing that they were findable) they had no effect. I have tried with .NET versions 3.5 and 4.0.30319.

  • I played with the tmp files and AppData folder

I made sure to remove all tmp files before I tried to run the .bat file again. I also tried to run the .bat file that was generated to try to manually populate the tmp file, but this had no effect.

  • I have tried to edit the GetVSComnToolsPath.bat file

I’ve attempted to hardcode the path to Visual Studio by changing the end part of the code to:

GOTO :EOF
:normalisePath
SET VSComnToolsPath=“A:\APPLICATIONS\VisualStudio\Common7\Tools”
GOTO :EOF

I then took it a step further and re-wrote the entire .bat file to this:

@anonymous_user_add01a93 off
SET VSComnToolsPath=
GOTO :EOF
:normalisePath
SET VSComnToolsPath=“A:\APPLICATIONS\VisualStudio\Common7\Tools”
GOTO :EOF

This produced an error saying that a copy of VS2013 could not be found.

Where I am now

Suffice to say I’ve tried a lot. I’ve done a lot of research and implemented a lot of the solutions to the problem others have had but nothing seems to be working.

Am I missing anything?

Many, many thanks in advance.

Mark

Is there no one who has experienced this issue before? I’m completely out of ideas.

Hi ,

We are not entirely sure why this is getting stuck for you.

Try opening the UnrealBuildTool.csproj file (you can find this in Engine\Source\Programs\UnrealBuildTool) in Visual Studio, then run this through the VS debugger using the “-projectfiles” argument. Once it is running, you will be able to see where it is getting stuck.

Hey, thanks for getting back to me with that suggestion. I have attached a screenshot of the output from the debug console. I personally couldn’t spot anything amiss but you may spot something I missed.

Thanks in advance :slight_smile:

Hi there, I checked the call stack and it seems to break on '> mscorlib.dll!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext) Unknown’ and informs me that ‘mscorlib.pdb’ is not loaded.

This is just before BatchFileProcess.WaitForExit(); is called in VCEnviornment.cs on line 322.

When you mention that it breaks, are you hitting an actual break point in VS? If so, would it be possible to see the full call stack at that point?

Hey, sorry I should clarify: I am not breaking on any specific break points. I click ‘break all’ in the debug menu after the program gets stuck. I then look at the call stack. I’ve attached an image of the call stack when it gets stuck below.

When the process hangs, go to your Temp folder (normally located at C:\Users\UserName\AppData\Local\Temp) and locate a recent file there whose name will follow the format tmpXXXX.tmp.bat, where XXXX is a random string of characters. Open this batch file, and it will contain a call to two files, one in your VS Tools folder, and one in the Engine source code. Try running each of those files manually. We think that it may be one of those two files that is hanging.

Hi ,

I did as you requested. The tmpXXXX.tmp.bat file contained:

call "A:\APPLIC~1\VISUAL~1\Common7\Tools\../../VC/bin/X86_AM~1/VCVARS~1.BAT" "A:\APPLIC~1\UE\Engine\Binaries\DotNET\ENVVAR~1.EXE" "C:\Users\Mark\AppData\Local\Temp\tmp35AF.tmp"

I ran both of these manually when the program hangs but to no effect. The .tmp file is also empty still as I mentioned before in my question. I should of noted before that EnvVarsToXML.exe does run. However, multiple instances of the process seem to run.

Is there a this .exe is corrupt??

EDIT: It’s also worth noting that I can’t just kill the EnvVarsToXML.exe processes, even using other tools like Process Explorer, I always have to restart my PC.

Hi ,

Sorry, I lost track of this post. Is this still giving you trouble?

If you are still experiencing problems here, could you try building EnvVarsToXML.exe yourself (this will be located inside the Programs folder in the UE4.sln). Then run EnvVarsToXML with the path to the .tmp file as the only command line argument. This should help us narrow down where it hangs.

Hi ,

No worries. I managed to fix it just the other day. I THINK it was my antivirus causing conflicts. I have now generated the sln files. I am having trouble build it because the compiler doesn’t have enough heap space. I imagine that’s just my computer being low on memory?

1 Like

I am glad to hear that you were able to get this working for you. Some Antivirus software has been known to interfere with building the Engine, though I believe this may have been the first time any interference has occurred in this step.

Would you be able to provide your dxdiag information? The time it takes to build the Engine from source code is directly related to your computer’s capabilities. My computer here at work typically takes around 20 minutes to build the Engine, but this machine is quite powerful, and I am able to take advantage of Incredibuild on our internal network to speed the process up. My personal computer at home is a different story entirely, though. The computer I use at home is rather elderly (and probably should be retired soon), and when I try to build the Engine there it takes a little under three hours. I try to avoid having to build the Engine at home.

I ran into the same issues. Disabling AVAST antivirus did the trick.
Building took about 5 seconds after that by the way.

1 Like

I had the same problem.

As stated, the antivirus was preventing the EXE from starting.
Disabling the antivirus (Avast in my case) allowed me to generate the project/solution.