Why cant I generate visual studio project files

Hi Everyone,

I have the issue where when I try to rebuild my visual studio project files I get the error listed below. I’m at a loss and cant get around this error. Any help or input would be appreciated.
Thanks!

Running C:/Program Files/Epic Games/UE_4.18/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project=“C:/Users/Ron White/Documents/Unreal Projects/projects/codetests/codetest/codetest.uproject” -game -rocket -progress -log=C:\Users\Ron White\Documents\Unreal Projects\projects\codetests\codetest/Saved/Logs/UnrealVersionSelector-2018.10.03-23.20.38.log
ERROR: UnrealBuildTool Exception: System.UnauthorizedAccessException: Access to the path ‘c:\users\ron’ is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share)
at UnrealBuildTool.UnrealBuildTool.GuardedMain(String[] Arguments)

Hello rfw7755,

Does the user “Ron White” have administrative privileges?

If you navigate to your C:/Program Files/Epic Games/ folder and right click-> Select Properties-> Select Security-> Edit the permissions to allow access to all users.

Does this result in any success?

@NicholasMont this is not a privilege problem but a string construction issue involving white space. something was changed in UBT that creates the same error you can face sometimes in Linux when path with white space are not handle properly.

I have a very similar or even the same problem. When I tried with UE 4.20, the message is different, but results in the same, more or less.
When I tried generating project files with 4.19, I got the exact same message though, down to UnrealVersionSelecter.log file and the UnauthorizedAccessException to the cut part of the user name.

I just opened a question here, too: Can't Generate Project Files - Unauthorized access to other PC's accounts - C++ - Unreal Engine Forums

But it seems my guess was wrong. I had, coincidentally, a 2nd user with the very same name (in this case: ron), so I thought the system tried accessing the 2nd user. But if that’s not the case for you then that really just leaves the white space issue.

Can Staff clarify? This is a really big issue with no easy fix on the OS side. I think the UBT needs to be fixed ASAP.

Bump. This is an important bug and deserves attention.

Hello rfw7755 ,

if you open a terminal directly from your UBT folder and try the following:

./UnrealBuildTool.exe -projectfiles
-project=“C:/home/test/Documents/Repro 18/Repro18.uproject”

Does this work? If this is not successful, open a terminal from desktop and try:

“C:/Users/Ron\ White/Documents/Unreal
Projects/projects/codetests/codetest/codetest.uproject”

Please let me know what results you receive.

Thank you!

I can’t speak for rfw7755, but as I have the same problem my answer might help you. I did not try the first one as I do not understand it. I did, however, test the 2nd one, which results in an error message because the program will then try to look up FirstName\ LastName which obviously does not exist.

So, escaping the whitespace does not work.

However, that was not necessary in the first place. using the UBT via command line works just fine when given the proper path of C:/Users/FirstName LastName/…/Project.uproject". It seems only the rightclick function does not work. I do, however, get the following warning which seems unrelated. I thought it was worth mentioning though.

So I can use this as a workaround for now.

I did have the same issue today. I have successfully generated project files probably >100 of times for this project in the past few years, and today is suddenly didn’t work any more. I do use whitespaces in the path, and that seems to be the issue.

Doing it with the first method you mentioned worked, thanks for that! Still significantly more inconvenient than right clicking the uproject file.

Actually, it did NOT work. It says “writing project files… 100%” and everything looks good, but it never created a new .sln file, the file was not modified. Now I deleted my old .sln file and it does NOT create a new one. So unfortunately this does not seem to workaround the issue. @NicholasMont @Quexlaw

Hm, can you post your batch file here so that I can try that?

Thanks! But actually, that’s not doing anything for me, I just see “Press any key…” immediately after opening it.

Could you maybe format your post so that the .bat is in code format? Maybe the formatting here breaks it. I mean this code format stuff:

Test123

Thanks! The .bat file works now, but the issue is same now like previously, it says everything would finish successfull but I don’t actually get any .sln file generated. Very weird that it works for you but not for me! Which UE4 Version are you using? I’m on 4.19.

I’m not using a launcher build, so I have copied in my custom path where the engine is installed, yeah.

That’s weird. It definitely does work for me. Even wrote a batch script so I could use it for all of my projects, just in case, and I tested by creating a new project, as well as deleting my old .sln.

Sure, but it’s kind of a cheat, so you will have to edit some of the lines.

REM Project must be in FirstName LastName\Documents\Unreal Projects to work

@echo off
set /p projectName="Enter Project to generate files: "
“C:\Program Files\Epic Games\UE_4.20\Engine\Binaries\DotNET/UnrealBuildTool.exe” -projectfiles -project=“C:\Users\FirstName LastName\Documents\Unreal Projects%projectName%%projectName%.uproject”

@pause

The parts you have to edit should be obvious.

EDIT:
When executing the batch file, you just have to type in the name of your project, such as “BestProject”. Do not specify a path, just the name of the project. This batch file will look it up for you if you specified the path in the batch file correctly.

REM Project must be in FirstName LastName\Documents\Unreal Projects to work

@echo off
set /p projectName="Enter Project to generate files: " 
"C:\Program Files\Epic Games\UE_4.20\Engine\Binaries\DotNET/UnrealBuildTool.exe" -projectfiles -project="C:\Users\FirstName LastName\Documents\Unreal Projects\%projectName%\%projectName%.uproject"

@pause

4.20. Did you change the UE_4.20 in the path as well? That may be the reason if you are trying to use the 4.20 UBT to build the 4.19 project c++ data.

I see. Tough luck. I think you should create a new question here and expand upon it, for better visibility.

@NicholasMont could you comment on this? I would really like to be able to generate project files again…

Hello John,

The Terminal commands provided are for a linux environment, are you using Windows Or Linux?
If you’re using windows, I’d like to ask you to please create a separate question with more details specific to the issues you’re experiencing.

Thanks!

Sincerely,
Nicholas