Can't compile inside UE4 Editor after moving folders

I have this problem that I know how to temporarily fix.

Let’s say the folder the project was initially in is:


Then, I had to add some extra projects to the source control system, so I created a new folder called MyGameWorkspace and moved the project to that new folder, like this:


The problem is: eventually, and I’m not sure when yet, a folder gets created at the old location (C:/MyGame) and, apparently, that causes the engine to go nuts.

If I try to compile from VS2017 everything works perfectly, but if I click the Compile button inside UE4, I get this error:

ERROR: System.IO.FileNotFoundException: Could not find file 'C:\MyGame\MyGame.uproject'.

The temporary solution is to delete the C:\MyGame folder and click Compile inside the editor again, and it will work perfectly after that.

It seems to me I have two problems:

  1. Why that old folder gets created?
  2. Why the editor priorizes that folder when trying to compile?

Thank you for your attention!

Hi @allskar, have you tried deleting the intermediates folder in MyGame and running GenerateProjectFiles again? Perhaps there are generated headers/intermediates etc. which are still pointing to the old directory?