Download

ERROR: Unable to instantiate instance of 'project' object type from compiled assembly

I get this all of a sudden on UE 4.17. The same course I have done 5 times on different versions and all worked including on this one 4.17. It worked on 4.15-4.19, and 4.24.

Entire Compiler Log:

Compiling game modules for hot reload
ERROR: Unable to instantiate instance of ‘TPSOLD’ object type from compiled assembly ‘TPSOLDModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’. Unreal Build Tool creates an instance of your module’s ‘Rules’ object in order to find out about your module’s requirements. The CLR exception details may provide more information: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.MissingMethodException: Method not found: ‘Void UnrealBuildTool.ModuleRules.set_PCHUsage(PCHUsageMode)’.
at TPSOLD…ctor(ReadOnlyTargetRules Target)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object] parameters)

EDIT: I managed to package the project then reload it and it compiled then. But the .sln solution is missing from packaged projects. How do I get the .sln solution back? Can I just copy it? Is there more then just a .sln file?

Don’t use Hot Reload. Might not seem like a valid answer, but it is the answer.

I suggest using Live Coding instead for small iterative changes to CPP files. Constructor/Class layout changes always require a full restart.

How do I choose to use Live Coding and turn off Hot Reload? Is it a setting in Visual Studio?

There’s a drop-down box in editor next to the “compile” button in the toolbar to enable live coding. From there it’s pretty self-explanatory.

It’s only available in more recent engine versions (4.22+)

Ok thanks. I got this error on an older version, 4.17. So no way to avoid this in older versions?

I was having the same problem while building before opening the project.
Solved by deleting the saved, intermediate, build and .vs folders; then regenerate the project, and rebuild.

3 Likes

The fix for me was: Go to \AppData\Roaming\Unreal Engine\UnrealBuildTool>delete BuildConfiguration.xml>rmb the [project name].uproject file>generate visual studio project files. Also, VS>Tools>Get tools and features>“Installation details”(on the right-hand column)>Game development with C++>CHECK “Unreal Engine Installer”>Modify>Launch VS

I now have new build errors which I need to track down…

This helped reduce my compile errors, although deleting the entire “saved” folder seems pretty severe. It seems like the log sub-folder is the only one which gets re-created after re-generating the project, so deleting just the Saved/Logs folder should be suffice.