# How to fix third party dll include not being staged correctly?

**URL:** <https://forums.unrealengine.com/t/how-to-fix-third-party-dll-include-not-being-staged-correctly/662957>\
**Category:** C++\
**Tags:** Builds, unreal-engine, Packaging, packaging-projects, UE4-27, question\
**Created:** [October 5, 2022, 1:50pm UTC](https://forums.unrealengine.com/t/how-to-fix-third-party-dll-include-not-being-staged-correctly/662957 "2022-10-05T13:50:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![k\_a\_s\_s\_k\_a\_s\_s](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/k_a_s_s_k_a_s_s/32/555828_2.png) [@k\_a\_s\_s\_k\_a\_s\_s](https://forums.unrealengine.com/u/k_a_s_s_k_a_s_s)\
**Post date:** [October 5, 2022, 1:50pm UTC](https://forums.unrealengine.com/t/how-to-fix-third-party-dll-include-not-being-staged-correctly/662957/1 "2022-10-05T13:50:17Z")

</div>

Hi Unreal forums! **I am using a pre-built C++ library in my project using dynamic library files.** The library is contained in a plugin, let’s call it `MyPlugin`. Building/packaging/playing in editor works fine.

However, a packaged build doesn’t start, giving the following error: `Code execution cannot proceed, MyPluginLib.dll was not found`. This is due to the fact that the packaging process places `MyPluginLib.dll` file in `MyProject\Plugins\MyPlugin\Binaries`. However, the execution process is seemingly looking for it in `MyProject\Binaries` – moving the library there manually solves this issue.

**Why doesn’t the execution find the library dll in the first folder? Is there something wrong in the build.cs, or my folder structure?**

The folder structure of the plugin folder is as follows:

- Includes in `Plugins\MyPlugin\Source\ThirdParty\MyPluginLib\`
- Binaries in `Plugins\MyPlugin\Binaries\(PLATFORM)\`

The plugin’s Build.cs looks like this:

```auto
public class MyPlugin : ModuleRules
{
	public MyPlugin(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

		string PluginRoot = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", ".."));
		string PlatformString = Target.Platform.ToString();
		string LibraryDirectory = Path.Combine(PluginRoot, "Binaries", PlatformString);

		PublicIncludePaths.Add(Path.Combine(PluginRoot, "Source", "ThirdParty", "MyPluginLib"));

		if ((Target.Platform == UnrealTargetPlatform.Win64))
        {
            PublicAdditionalLibraries.Add(Path.Combine(LibraryDirectory, "MyPluginLib.lib"));
            RuntimeDependencies.Add(Path.Combine(LibraryDirectory, "MyPluginLib.dll"), StagedFileType.NonUFS);
        }
        else if (Target.Platform == UnrealTargetPlatform.Linux)
		{
			// linux binaries...
		}
}

```

Would appreciate any help.

---

<div class="post-metadata">

**Author:** ![sheen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sheen](https://forums.unrealengine.com/u/sheen)\
**Post date:** [June 22, 2025, 6:59am UTC](https://forums.unrealengine.com/t/how-to-fix-third-party-dll-include-not-being-staged-correctly/662957/2 "2025-06-22T06:59:16Z")

</div>

Same problem here

**when BuildPlugin with RunUAT.bat, the RuntimeDependencies are not staged as Unreal documentation**

with Package plugin from editor, all RuntimeDependencies are staged correctly.
