This project is read-only.

SourceTfs.Checkout Multiple Files

Jun 30, 2008 at 8:56 PM
I was wondering why the Path property for Checkout and then hence Checkin was set up as a string instead of ITaskItem[]?  The string only allows for specifying a single file or folder.  I have the need to update all the assembly info files in our solution with each CC.NET build so I wanted to be able to just take the AssemblyInfoFiles item I had created as follows:

        <AssemblyInfoFiles Include="**\AssemblyInfo.*"/>

and pass it into the SourceTfs.Checkout task to check them out.  This doesn't work because as a string property it isn't broken up.  As such I wrote my own custom task based on the SDC task that replaces the Path property type with ITaskItem[] and then iteratively calls the previous Execute code passing each item as a new Path into the method.  I also did the same for the CheckIn.  This may be worth changing in the main codebase as even if a user is passing in a string it should translate it to a 1 length array of ITaskItem.
Jun 30, 2008 at 11:01 PM
I'm not in contact with the author of the task any more, so I can't give you any historical reason, however I think you raise a perfectly valid point. You've actually highlighted a general flaw throughout the SDC Tasks Library though, where many tasks would be better written using ITaskItem. It's something that is being looked at for a derivative of the library.

On a side note, please take a read of this post:!EC3C8F2028D842D5!404.entry, for some thoughts on versioning files in TFS.

Thanks for the feedback.


Jul 1, 2008 at 4:34 PM
Thanks for the link.  I found it rather interesting and will keep it in mind if we ever switch to having TFS run the builds instead of CC.NET.  Also if needed I would be interested in working on some of the TFS tasks if the original author is no longer available as I could see the use of a undo-checkout and a few other items that would be nice.
Jul 5, 2008 at 10:51 AM
Edited Jul 5, 2008 at 6:48 PM

You should be able to accomplish what you want to do with the existing tasks and batching, e.g.

    <AssemblyInfoFiles Include="YOURROOTPATH\**\AssemblyInfo.*"/>


<Target Name="Stuff">

    <SourceTfs.Checkout Path="%(AssemblyInfoFiles.Identity)" TfsVersion="2008" WorkingDirectory="YOURROOTPATH"/>



You still have a problem with checkin though as you will have multiple changesets. If you really need this now, just resort to shelling out to tf.exe.