Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Specify dll location using plugin in cooked project?

I have made a plugin to interact with some exotic hardware that we use internally. This plugin depends on a third party DLL file. Lets call this file my_exotic_hardware.dll. I have successfully made the plugin work in both the editor and in runtime. My only problem right now is when I package this project the plugin DLL end up in the wrong folder.

Right now the DLL file end up in the folder:


So I every developer is forced to manually move the file from this folder to the same directory as the game executable, i.e. the root of the above path.

How do I adapt my build script so that the DLL file gets copied into the correct library during packaging? I would like to avoid the manual copy.

Product Version: UE 4.20
more ▼

asked Oct 30 '18 at 09:50 AM in Packaging & Deployment

avatar image

1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

This is a few months old, but since nobody has answered you, there are 2 steps:

  1. Copy the .dll file into the Binaries folder

  2. Adding the copied DLL to the runtime dependencies.

Everything below goes into your .build.cs file.

First, a couple helper functions to copy the DLL:

 public string GetUProjectPath()
     return Path.Combine(ModuleDirectory, "../../../..");
 private string CopyToProjectBinaries(string Filepath, ReadOnlyTargetRules Target)
     string BinariesDir = Path.Combine(GetUProjectPath(), "Binaries", Target.Platform.ToString());
     string Filename = Path.GetFileName(Filepath);
     //convert relative path 
     string FullBinariesDir = Path.GetFullPath(BinariesDir);
     if (!Directory.Exists(FullBinariesDir))
     string FullExistingPath = Path.Combine(FullBinariesDir, Filename);
     bool ValidFile = false;
     //File exists, check if they're the same
     if (File.Exists(FullExistingPath))
         ValidFile = true;
     //No valid existing file found, copy new dll
     if (!ValidFile)
         File.Copy(Filepath, Path.Combine(FullBinariesDir, Filename), true);
     return FullExistingPath;

Next, make the DLL a dependency so it gets copied automatically:

 string pluginDLLPath = PATH_TO_YOUR_DLL_FILE;
 string binariesPath = CopyToProjectBinaries(pluginDLLPath, Target);
 System.Console.WriteLine("Using Python DLL: " + binariesPath);
more ▼

answered Jan 25 '19 at 10:44 AM

avatar image

188 4 11 23

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question