XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Overriding CopyFilesToOutputDirectory Target

Last post 12/14/2007 2:55 PM by Nick Gravelyn. 3 replies.
  • 12/13/2007 8:13 PM

    Overriding CopyFilesToOutputDirectory Target

    Working on XnaZipLib again and I found that this Target is overriden in the ContentPipeline.targets file so that the main project has control of copying files from the content project. How can I change this up a bit? I want users to be able to add any files they wish to the content project, set them to Copy If Newer (or Copy Always) and have them copied into my temp directory so I can zip them up with the rest of the content.

    Any pointers or suggestions?
  • 12/14/2007 1:31 PM In reply to

    Re: Overriding CopyFilesToOutputDirectory Target

    Stephen may be able to answer this better: it's been a while since I looked at those targets!

    It seems like you could just replace that target with whatever implementation you need, since our version doesn't do anything by default, but I might be missing something.
    XNA Framework Developer - blog - homepage
  • 12/14/2007 2:37 PM In reply to

    Re: Overriding CopyFilesToOutputDirectory Target

    The content project doesn't use CopyFilesToOutputDirectory, but it does support "Copy Always" and "Copy if Newer" on files in the project. The content project doesn't really use the OutputPath property, so it leaves copying source items up to the parent project. This is done by the parent project invoking GetCopyToOutputDirectoryItems, and adding the outputs to its own list of files to copy to the output directory.

    To get a list of the files that would be copied, make your target depend on the AssignTargetPaths target, and use the ContentWithTargetPath and _NoneWithTargetPath item groups that it creates. That will be the list of files that would be copied, if we were to copy them.

    It's up to you if you want to copy them somewhere before zipping them, or if you can just pass the item groups as they are to your zip task.

     

    Stephen Styrchak | XNA Game Studio Developer
  • 12/14/2007 2:55 PM In reply to

    Re: Overriding CopyFilesToOutputDirectory Target

    Sounds good. I'll definitely be giving that a shot later tonight.

    My plan is to have the content project build to it's own bin directory and copy any files in that project set to copy to that same directory. Then I just scoop up all the files inside that directory, zip them up, and send that to the parent's output directory. So my goal is to stop the parent project from copying over those files and let the content project take care of them.

    On a semirelated note, my library is working for all built content, but a Content directory still gets added to my game project's output directory right next to my zip file. Where is that folder created in the MSBuild targets? I tried looking earlier but couldn't find it. I'm not copying anything, but it just creates an empty folder there as if my built content were getting sent there.

    Thanks again.
Page 1 of 1 (4 items) Previous Next