I’ve added GameplayTasks in my game.Build.cs file inside the PublicDependencyModuleNames section…
now it works but I don’t know why my project needs them now…
It’s because unreal/epic failed to establish the dependency between AIModule and GameplayTasks. If when I use things from AIModule like behavior tree and that won’t compile if I don’t have GameplayTasks, shouldn’t it be clear that including AIModule requires GameplayTasks to be included as well? And it should be implicitly handled or give clear error messages rather than obscure link errors on code we never touch. Again please test your engine before releasing it. Add unit-test also please if you want to be a proper engine developer.
Also had this problem and solved by adding GameplayTasks module to the PublicDepencencyModuleNames in the Build.cs file, as suggested by previous answers