Couldn't find target rules file

Currently I can’t even compile a blank project with a blank class added. I attempted to get back into unreal after a few months of doing other things and now none of my projects work if I try to change any code. If I try to change the engine version, I can no longer open it in the editor. If I change any code, it no longer compiles. Sometimes i get some strange errors but this one consistently shows up.

Couldn’t find target rules file for target ‘blahblahblah’ in rules assembly ‘UE4Rules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’. blahblahblah

I found others who had posted about this problem but they were either from a while ago and had answers that don’t apply to the current UE or just didn’t work.

I only work with one other person who’s using UE4 and he’s not having any issues, after trying to troubleshoot with him I’ve found that our only real difference is that I’m running Windows 7 and he’s on Windows 10.

Hello frostymm,

I’m not sure what fixes you may of found, but have you tried deleting your Intermediates and Binaries folders, re-generating your project files by right-clicking the .uproject file, compiling, and attempting to launch?

If that doesn’t work, could you post all of the errors that you get when creating a new blank C++ project? Does it require adding a new C++ class to get these errors? If so, what kind of C++ class are you adding?

Upon performing those steps, I still get the errors on compile:

Couldn’t find target rules file for target ‘MyProject2Editor’ in rules assembly ‘UE4Rules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’. MyProject2 C:\Users\Documents!Unreal Projects\MyProject2\Intermediate\ProjectFiles\EXEC 1

MSB3075 The command ““C:\Program Files\Epic Games\4.11\Engine\Build\BatchFiles\Rebuild.bat” MyProject2Editor Win64 Development “C:\Users\Documents!Unreal Projects\MyProject2\MyProject2.uproject” -waitmutex” exited with code 5. Please verify that you have sufficient rights to run this command. MyProject2 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets 42

And upon creating a new blank C++ project and before adding any new C++ classes, I get this one in addition to the previous ones:

System.UnauthorizedAccessException: Access to the path ‘C:\Users\Documents!Unreal Projects\MyProject3\Binaries\Win64\UE4Editor-MyProject3.dll’ is denied. MyProject3 C:\Users\Documents!Unreal Projects\MyProject3\Intermediate\ProjectFiles\EXEC 1

Thank you for those error messages and trying what I mentioned. These messages about access being denied usually point to Visual Studio not being run as Administrator or a software conflict. Can you check this webpage to ensure that you don’t have any of the software that is known to conflict with the editor? If not, can you try temporarily disabling your virus protection software to see if it may be blocking Visual Studio from accessing what it needs to?

Okay, making visual studio run in administrator didn’t cause any change and I don’t have any software in that list running. I think the only one I even have is teamviewer but I’ve never run it at the same time as unreal.

Disabling my virus protection software didn’t cause any change either. Still the same errors.

You’re getting the “Couldn’t find target rules file for target” error with a brand new project? Also, what build configuration are you using in Visual Studio? If it’s anything other than Development Editor, can you try that to see if it changes the results?

Yes, it’s a brand new project with no classes added and the Development Editor configuration is selected.

Thank you for that information. I can’t think of any thing else to check at the moment but I did find a couple other reports of people with a similar issue. Could you take a look at these two posts and see if any of the fixes proposed are able to help you?

I actually attempted the fix with the Games.uprojectdirs file before but I didn’t understand the directions. It says to put this file in the root directory for the engine/project. For some people, all of the project files and engine files were in the same place and for others they just had one location where an unreal engine was installed. But for me I have multiple versions through the Epic Games Launcher.

I have my engines install to here:
C:\Program Files\Epic Games

I have a folder for 4.7, 4.9 and 4.11

And my projects install to my documents/!unreal projects

So where am I supposed to put this file? Do I put it in all of the engine version folder? and then if so do I put it in the root of that or the actual Engine folder within?

I remember going through a lot of nonsense with this one.

I’ve never had to this manually myself, but from looking at the builds that I have on my computer, the “root” location is the same folder that contains the .sln file (Or in a project that doesn’t have source, look for the .uproject file) which applies to both an Engine installation and a Project directory. The dirs file is going to be going into folders from that point, as it may be including Samples and other folders that are on the same level as the Engine folder.

There shouldn’t be a problem with placing it in each one of those engine installations either.

Well I’ve attempted putting the file in both the engine location and the project location.

Just Games.uprojectdirs with the full filepath to the uproject file of that blank project.

Unfortunately no luck though.

From what users are mentioning on those other posts, they are all using engine versions built from source that they downloaded from Github, so that would explain why the .uprojectdirs solution isn’t working for you. It does make it all a bit more confusing however as I’m confused as to how you would even get this error with a Binary build from the launcher.

Have you tried verifying these engine installations through the launcher or reinstalling them?

This currently happens with all three of the engines I have installed; 4.7.6, 4.9.2 and 4.11.2. I definitely tried reinstalling 4.11, should I try verify instead this time?

I had the idea of getting someone else to look at this and they noticed that there is a ! in your filepath, between the Documents and UnrealProjects folder. This could be causing the compiler to have issues reading the file path. Could you remove that and see if it fixes the issue?

That seems to have fixed the problem!

I put that there to manage my folders so that the important ones always stay at the top of the list. Guess I won’t be able to do that for this one.

Thanks a ton for your help!

I’m glad to hear that it’s fixed. If you wish to continue doing that, a _ may work better as that is something that can be included in a project’s name so the compiler should be able to read it.

ive got the solution the missing file target is missing because visual studio cant write files with a long address so either copy it closer to your drive so the addressing of different files is smaller. there is a upper limit of how much you can stack up your folders. if you reach it the file wont be made without notice.

this is also what causes visual studio to having weird glitches sometimes.

如果上面两个答案没用的话,试试我这个。

If those two answers are useless,Try mine.

这个问题我花了大半天时间来搜索解决方案。终于找到了有用的东西

I spent almost half day to search for the solution to this.Finally, I found something useful.

可以参考一下上面两个问题的答案,其实两个都一样。

You can refer these two links above. Both the same, either one will be fine.

为了方便你们,我直接复制了解决方案:

For your convenient, I copyed it :

This is a known issue with changing to 4.12 and using tasks. It can be resolved by simply adding “GameplayTasks” to the PublicDependencyModuleNames section inside your ‘ProjectName’.Build.cs For example:
PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore”, “AIModule”, “GameplayTasks” });

在YourProjectName.Build.cs里的PublicDependencyModuleNames加上GameplayTasks就行。

Add GameplayTasks to PublicDependencyModuleNames of the YourProjectName.Build.cs file~.