Why can't I add code to project?

I’m using Visual studio express 2013 for windows desktop and just installed UE4. When I add code to my blank project it says “Failed to add class, failed to generate project files”. Seems like it can’t find my Visual studio. How can I fix this?

Try adding the file using the file explorer and regenerating your project files. I am not sure your question is correctly targeted for this section, as it may be an install bug and need triage, as such. If you are trying to add files using VS, i am not sure how you could have problems finding VS.

Im using the unreal editor to add the file via File-Add code to project…When I click create it shows the error. I think I need to point the editor to the visual studio location but I don’t know how to do that.

Check your Windows environmental variable VSCOMNTOOLS, that it points to the correct location. That’s located from properties on computer, Advanced Settings, then the button Environmental Variables. It’s under System Variables near the bottom.

Also, do you have the Windows SDK 8.1 installed, and the DirectX June 2010?

Ah, the variable pointed to the wrong hard drive. Thank you!

This doesn’t work for me – I changed it to the correct environmental variable, but the “Add Code To Project” button is still just grayed out in the Unreal Editor. I’m running . Is there anything else I need to do?

I am having this exact problem. What is the correct location for VSCOMNTOOLS?

I did not have a VSCOMNTOOLS variable (instead had numbered ones: VS90COMNTOOLs, VS120COMNTOOLS, VS110COMNTOOLS, VS100COMNTOOLS) so I added the de-numbered one with a path to the Tools directory of my VS2013 install, is this correct?

It hasn’t fixed the problem… but perhaps it is something else.

Hi ,

If you are editing your environment variables, then the one for Visual Studio 2013 should be named VS120COMNTOOLS.

I’m having this same problem. I have VS2013 Ultimate with Update 4 installed. I checked the VS11COMNTOOLS and VS12COMNTOOLS environment variables, and they’re set correctly.