GetModuleFilename(string) is obsolete vc14 UE4.12

Before I have linked third party libraries with UE4 and it worked, but now I tried again in a new project and I got the error below:
Error CS0619 ‘UnrealBuildTool.RulesCompiler.GetModuleFilename(string)’ is obsolete: 'GetModuleFilename is deprecated, use the ModuleDirectory property on any ModuleRules instead to get a path to your module.

Is there an updated guide? I tried googling for it, but it only listed the one I already was using.

Guide I followed.

Anything else that has changed?

For anyone who faces the same kind of problem:

All I had to do was to replace “return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));” with “return ModuleDirectory;”.

That fixed it.

1 Like

Perfect, worked for me!

Great. Thanks for comment and vote(?). It helps show which answers actually works.

+1 worked for me too. Thanks!

Worked for me too. Don’t forget to edit the file in both your engine folder and your project plugins forlder.