Automatically add files to MGCB file?

Is there any support in MGCB / Pipeline Tool for automatically adding copy-action files via wildcard? I have a folder of script files (.lua) which I’d like added to my Content.mgcb file so I can utilize the copying action from our raw asset directory to our build directory. Looking at the mgcb file, these files are added in a pretty simple manner:

#begin ../../../assets/scripts/ui/somefile.lua

However adding these files manually would be very tedious. Is there a way to automatically include all files of type lua in the scripts/ui directory, and simply have their asset name stay the same as whatever the actual file name is?

Not the end of the world if not, I will probably just write a python script to do the copying instead of routing it through the content builder. I would just prefer to keep all assets in one location and one build pipeline if at all possible.

1 Like

Not that I am aware of.

But if you don’t need your raw files to be processed, you could simply use the System.IO namespace for this.

Another approach would be to completly build you mgcb file dynamically (it’s just a text file) and then call the MGCB.exe with some arguments by yourself.

It’s also possible to do it by customizing your build process, when building with msbuild. The MonoGame.Content.Builder.targets runs a target called BuildContent just before your project builds. If you want to do any processing before or after this process you can use the BeforeTargets and AfterTargets mechanism provided by msbuild to run your own targest.

More information here:

1 Like

maybe this is related: How to change default build action for file type?

1 Like

If you can have them organized such that everything in the folder is always a copy action, you can simply remove the folder and readd it, within the pipeline tool (ie, right click parent, and choose ‘add folder’, choose it)

1 Like

I started working on a tool for this kind of job: Content Crawler Tool

1 Like

Oh cool thanks for sharing! I’ll take a look as soon as I get a chance. We’re coming up on a milestone and I’m not scheduled to do more asset work until after, so it might take a couple of weeks. But as soon as I’m back on asset pipeline I’ll mess around with it and get back to you in the linked thread with any feedback.