UBT Unable to determine module type

After the upgrade from 4.11 to 4.12.5, packaging or generating project files cause the following error to be displayed:

ERROR: Unable to determine module type for D:\...\Source\<ProjectName>\<ProjectName>.Build.cs

The project sets the “module type” in D:…\Source\ ProjectName .Target.cs like this:

public class ProjectNameTarget : TargetRules
{
  public ProjectNameTarget(TargetInfo Target)
    {
      Type = TargetType.Game;

      // Ensure that we compile with the Steam OSS
      UEBuildConfiguration.bCompileSteamOSS = true;
    }...

The code originally came from the doc here: Build Target. UBT appears to be ignoring the Type assignment. The code worked in 4.11. The 4.12 Release Notes mention some changes to UBT and Targets but nothing about changing the module type assignment in code. Should the Type assignment in the target code be updated to something new? Is this related to changing the VS default from 2013 to 2015?

Another user’s question that has a similar error message is:
No engine version

A couple more comments:

  • I created a new 4.12 blueprint project package and it packaged and ran without problems, then I added a c++ class and it also packaged successfully.
  • The log file is attached.link text

it seems like we both are the only one with this problem according to google. could you solve it somehow?

I’ve been working on it full time for 3 days. The issue seems to be inside Engine\Binaries\DotNET\UnrealBuildTool.exe, even running this from the command line with -verbose only produces the error and no more. I’m going to be AFK for a couple hrs, but will start looking through the source after that. I’ll post here if I find any thing useful.

i found a solution and i hope this will help you aswell. i made a new C++ project with exact the same name as my working-project. then i created the .vs files. opend vs and started the game. now that all files are created, i deleted the binaries, intermediate, build and save folder from my working-project. then i copied all that folders, the exe and vs + source files from the new project into my working-project. i was able to launch it and package the game. hope this helps you too my brother in suffering

I tried your method and it worked. In my first try, I copied over all of the files/directories (or so I thought) and it didn’t work. The magic one was replacing ProjectName.uproject. I copied that over, did a ‘generate project files’, opened the project in 4.12 and the packaging worked. Many, many thanks! I’ll mark your reply as the answer.

im glad i could help you! :slight_smile:

I just start to learning UE4 and already face this problem. Thanks for the solution. It’s worked fine here too.

I’d say this was already solved but my comments were too long for… well the comments section :slight_smile:

I ran into this same issue migrating some code from an existing project. This solution did work (thanks MajekPL)

The key turned out to be the uproject file (thanks Thorp) - I opened them up and was delighted to find they’re just JSON text files.

Failed to generate project files (blueprint project)

{
	"FileVersion": 3,
	"EngineAssociation": "",
	"Category": "",
	"Description": "",
	"Plugins": [
	//Blah blah blah (same)
	]
}

Successfully generated project files (new C++ project)

 {
	"FileVersion": 3,
	"EngineAssociation": "{DE101DE3-4830-ECCE-FBFD-8AAD629A2702}",
	"Category": "",
	"Description": "",
	"Modules": [
		{
			"Name": "<MyModuleName>",
			"Type": "Runtime",
			"LoadingPhase": "Default"
		}
	],
	"Plugins": [
		//Blah blah blah (same)
	]
}

Quick testing shows that the “EngineAssociation” is not necessary for generating project files and only the “Modules” section (makes sense).

So, potential quicker fix should be to add the “Modules” section to your .uproject once you have all the necessary C# and C++ stubs in place (which is probably most easily done by making a new empty project?).

"Modules": [
     {
          "Name": "<MyModuleName>",
          "Type": "Runtime",
          "LoadingPhase": "Default"
     }
],

This was the solution for me!!!
The section “Plugins” was missing in my .uproject file although we are using perforce. strange

Another possible cause of this is having a second .uproject file in a directory. We downloaded a package from the store that had its own project file for demo purposes, but this really confused UBT and made our app give this “Unable to determine module type” error. Deleting the second .uproject file fixed it for us.

I solved this after a while by removing the generated c++ files needed from some tutorial. The tutorial needed a simple c++ file and I generated one and called it MyClass. I guess it as from previous version of UE and when migrating to version I guess it came with it which could be the cause of the issue. I personally do not need it anymore so I deleted the class and all other files in {youproject}/Source/… In mine there were only a couple of files. Started a “package project” and it is building now. I do not know why exactly but I guess when those files are there some other file needs to be in place which was not ported from older project… or something similar :wink: It works now…

Hope this can help anyone…

I solved this after a while by removing the generated c++ files needed from some tutorial. The tutorial needed a simple c++ file and I generated one and called it MyClass. I guess it as from previous version of UE and when migrating to version I guess it came with it which could be the cause of the issue. I personally do not need it anymore as the project I try to build is a Blueprint only project, so I deleted the class and all other files in {youproject}/Source/… In mine there were only a couple of files. Started a “package project” and it is building now. I do not know why exactly but I guess when those files are there some other file needs to be in place which was not ported from older project… or something similar :wink: It works now…

Hope this can help anyone…

I also followed a tutorial and I had to create a C++ file; Now I can’t build my game because my Visual Studio doesn’t works. So, I did that you said (delete the content of /Source/ folder) and it’s now building correctly. You saved my project! Well, I wasn’t going to destroy my project because I had an 1 month-ago backup, but you saved to me a lot of time!