How to change default build action for file type?

Is it possible to change the default build action for a particular content type in the Content Pipeline tool?

My project uses a lot of content which needs the “copy” build action, but the default when adding a new piece of content is “build”. I’d like the content pipeline tool to default to “copy” when ever I add a “*.tmx” file.

Is this possible?

Thanks!

If you feel like modifying and compiling monogame’s pipeline, I have the following modification in my pipeline tool

Add

BuildAction buildAction= BuildAction.Build;
string extensionsToAlwaysCopy="*.bin;*.k3d;*.tmx";  // your extensions here

if (extensionsToAlwaysCopy!=null)
{
    string extension=Path.GetExtension (sourceFile).ToLower();
    var copyExtensionList=extensionsToAlwaysCopy.Split (';');
    if (copyExtensionList.Contains (extension)) buildAction=BuildAction.Copy;
}

before

        var item = new ContentItem
        {
            Observer = _observer,
            BuildAction = BuildAction.Build,
            OriginalPath = sourceFile,
            DestinationPath = string.IsNullOrEmpty(link) ? sourceFile : link,
            ImporterName = Importer,
            ProcessorName = Processor,
            ProcessorParams = new OpaqueDataDictionary()
        };

in

public bool AddContent(string sourceFile, bool skipDuplicates)

at file PipelineProjectParser.cs

you also have to change

BuildAction = BuildAction.Build,

to

BuildAction = buildAction

I must say that I forked my pipeline version a long time ago from the current MG branch, so I don’t know if this will work for sure in the current version.

1 Like