"Couldn't set association for project. Check the file is writeable" when trying to generate project files

I am getting this error constantly when trying to generate Visual Studio project files from a .uproject file that I have on a Perforce server. I have VS 2013, Unreal Engine 4.6.1, and Windows 7. I don’t understand what the error means, but every time I try to right click and select “Generate Visual Studio project files” or even launch it, I get the “Couldn’t set association for project. Check the file is writeable” error. I’ve tried re-installing the engine and deleting my workspace and setting up a new one, but nothing has fixed the matter. I’ve also tried to look elsewhere but there seems to be nothing on this issue.

If you grabbed your project file from a Perforce repository then the read-only flag will be set on the file. Did you try checking the file out using a perforce client? Once you check out, the read-only flag gets removed which will allow you to generate.

Thanks! I’m still trying to figure out the Perforce client; the way it allows access to files is a bit different from GitHub. Checking out files seems to be necessary to open the project as well, but I’m still figuring that out.

Bump since this is a top google hit for the error "Couldn’t set association for project. Check the file is writeable”. Spaces in the top level directory name can cause this misleading error message.

For example:

“E:\Projects\MyGame” - generate project files works, no errors

“E:\Projects\My Game” - generate project files fails, with above error message

​​​​​​​

For anyone is still looking for the solution:

“C:/Program Files/Epic Games/UE_5.1/Engine/Build/BatchFiles/Build.bat” -projectfiles -project=“D:/Unreal Projects/MyProject/MyProject.uproject” -game -rocket -progress

Can you please elaborate what is it and what do we have to do?

It is a command to associate the unreal files under your project. You can update the path string in the command and run it in a terminal window (on Windows you can use cmd).