I made a plugin, which uses some external codes.
By forum post, adding nuget plugin to csproj does not works - so I downloaded compiled dll file and added it into Content directory of plugin path.
And added options.ScriptingAPI.FileReferences.Add in Setup method in plugin’s Build.cs file.
but engine fails to add path -
[Info] error CS0006: Metadata file ‘/Content/ICSharpCode.SharpZipLib.dll’ could not be found
I tried /Content, /../Content, /../../Content but all failed.
What is the working directory of plugin’s build.cs, or ScriptingAPI.FileReferences called from plugin?
Paths are relative to the current build workspace (eg. project folder) but I would recommend using global paths, eg relative to the game project:
options.ScriptingAPI.FileReferences.Add(Path.Combine(Globals.Project.ProjectFolderPath, "Content/ICSharpCode.SharpZipLib.dll"));
or relative to the build script path:
options.ScriptingAPI.FileReferences.Add(Path.Combine(FolderPath, "../../Content/ICSharpCode.SharpZipLib.dll"));
You can use Flax.Build.Log.Info("message") to log stuff from build scripts into the console to debug this.
I see “FolderPath” quite often on manual. Is it provided by engine itself? Is it pointing “current build path” automatically assigned differently for each build game / plugin projects?