Generating project files (Expecting at least one ProjectTarget)

UnrealBuildTool Exception: ERROR: Expecting at least one ProjectTarget to be associated with project ‘D:\Documents\Unreal Projects\myproject\Intermediate\ProjectFiles\myproject.vcxproj’ in the TargetProjects list

What should I do?

Hey -

Exactly when are you receiving this message? Are you starting the editor from the Launcher or is this occuring elsewhere? Do you still get the message if you install 4.4?

Yes, I still get the message after 4.4.
I’m trying to generate project files to open my project in visual studio.
I’m right-clicking my ue4 project file, then “Generate Visual Studio Project Files”. And it gives me this error.

Is the issue specific to your project or does the same thing occur if you create a new project based on one of templates?

I tried to do the same thing on the ContentExamples Project (from marketplace), and it gives me this error:

UnrealBuildTool Exception: ERROR: Directory ‘D:\Documents\Unreal Projects\ContentExamples’ is missing ‘Source’ folder.

Actually, I got this error before in my project too, but I thought that adding a folder named “source” could resolve the problem.

Hey -

I believe I have found the root of your issue. It appears there are two files missing from your Source folder. One is ProjectName.Target.cs and the other is ProjectNameEditor.Target.cs. I would first check your recycle bin to see if they were deleted by accident and can just be dropped back into place. Another option is to create a new project and copy these files from the new project to your original project. If you do decide to copy the files over then you will need to change three lines within each file. The first two that need to be changed are near the top and the third is at the bottom of the files. Each file should have the following changes where “ProjectName” is the name of your original project (the file listed as Editor.Target should have “Editor” included as noted):

  1. public class ProjectName(Editor)Target : TargetRules
  2. public ProjectName(Editor)Target(TargetInfo Target)
  3. OutExtraModuleNames.AddRange(new string[] {“ProjectName”});

Let me know if you have any other difficulties, hopefully these changes will get you back into your project,.

Cheers

I changed the line 23 " OutExtraModuleNames.Add(“ProjectName”);" to my project, but now it gives me another error:

ERROR: Couldn’t find module rules file for module ‘ProjectName’.

The original Source folder probably didn’t go along when I migrated versions from 4.2 to 4.3… but I didn’t try to create project files before, and didn’t have problems with the project, so I deleted the older version project. =(

Did you make the change in the Target.cs or the Editor.Target.cs? Also, if you write the line out as

"OutExtraModuleNames.AddRange( new string[] { “ProjectName” } );

then I believe it should start working then. Keep in touch if you have any other problems or questions.

Cheers

I made the change in both files, I just changed the name of project in the lines…
the lines were like this:

public class ShooterGameTarget : TargetRules
public ShooterGameTarget(TargetInfo Target)
OutExtraModuleNames.Add("ShooterGame");

and in the Editor file:

public class ShooterGameEditorTarget : TargetRules
public ShooterGameEditorTarget(TargetInfo Target)
OutExtraModuleNames.Add("ShooterGame");

So I changed only the original project’s name for my project’s name…

public class MyProjectTarget : TargetRules
public MyProjectTarget(TargetInfo Target)
OutExtraModuleNames.Add("MyProject");

public class MyProjectEditorTarget : TargetRules
public MyProjectEditorTarget(TargetInfo Target)
OutExtraModuleNames.Add("MyProject");

isn’t that right?

PS: even changing the line

OutExtraModuleNames.Add("MyProject");

for

OutExtraModuleNames.AddRange(new string[] { "MyProject" });

on both files it still gives me the same error:
ERROR: Couldn’t find module rules file for module ‘ProjectName’.

Hey -

I apologize for the confusion. I believe I left out a step in the work around. After changing the mentioned lines in the code files, make sure to do a “Save As” and re-save the files as “ProjectName”.Target.cs and "ProjectName"Editor.Target.cs. Also ensure that the files are both inside the Source folder for your project. Let me know if that helps and I’ll be glad to take another look at it.

EDIT: I found it works best/easiest if you create a new “Basic Code” project and use the Target.cs files from that.

Hi ,

I had already changed the file names before, still the same thing…
I created a new blank project, but there is no Source folder in it. Is there any way to generate this folder without creating a new code-based project?

it will be a pain to create everything again…

Hey -

Unfortunately there is no way to create a Source folder unless the project is a code project or if you add code to a blueprint project. However simply creating a new code project should generate the files needed to edit. Could you submit the folder that includes your project so that I may work with it directly to find a solution?

Solved…

I clicked File->Add Code to Project, created a Material Function (as a test)… and it generated the Source folder and all the VS project and solution files.

Thanks for the help!

Solved…

I clicked File->Add Code to Project, created a Material Function (as a test)… and it generated the Source folder and all the VS project and solution files.

Thanks for the help!