How to associate work item information with tf.exe checkin command ? RRS feed

  • Question


    Hi All,


    I am having a problem to check in source code to TFS by using the command give below:


    tf checkin AssemblyInfo.cs   /recursive /noprompt


    The problem is that we have a policy at our company to not to check-in without specifying a work item and this is the reason that I don't want to user /override option here.


    I'll appriciate any help.




    Thursday, March 13, 2008 3:05 PM


All replies

  • Hello,

    I'm afraid "tf.exe checkin" does not support specifying work items from the command line. Could you describe scenario in which yoiu need it?

    "tf checkin" supports /saved option which allows reusing work items, comments etc - http://msdn2.microsoft.com/en-us/library/c327ca1z(VS.80).aspx but it work only in certain scenarios

    Thursday, March 13, 2008 3:27 PM
  • Hi,

    thanks for reply. Actually we are automating our build process and one of the task in the whole process is to update assembly and files version of all the projects of a solution.

    Actually we are using  a third party tool (command line unility) to increment AssemblyInfo.cs for all the projects in a solution and I have to make a script which will perfrom the following actions:

    1) check-out all AssemblyInfo.cs files from source control ( usig tf.exe ..)

    2) increment the assembly and file version in AssemblyInfo.cs by using the third party tool

    3) Check in the updated  AssemblyInfo.cs files to source control. (using tf.exe ..)


    And now the problem is specifying work item along with the checkin command. Is the anyway that i can do the the last task in above list in some other way?





    Thursday, March 13, 2008 3:42 PM
  • Well,

    so with what work item you would like to associate this changeset? Do you want to create new work item every time you increment version, or you always use the same work item?

    I would say that overriding this policy here (when all changes are automated) is justified but I don't know what are implications in your case of doing so (how all overrides are reported etc.)

    Thursday, March 13, 2008 5:12 PM
  • Hi,

    I could use same work item every time if there is no option to associate my change set with a new work item from commad prompt.

    Actually I'll make a controller application which will be responsbile to call a batch script and pass it a version number and a work item, the batch script will then call tf.exe to check in source code.


    As you have remommended to override the policy but I cannot do that because we have a requirement to pass the work item every time when we check in.


    No I don't know how to procced at this point. Any suggestion would be helpful.





    Thursday, March 13, 2008 11:45 PM
  • There is no single command-line command to do the check-in and associate that changeset to a specified work item. However, you can do this with two commands.


    In your controller application, after the "tf checkin", you can use "tfpt workitem /update" to associate the changeset to the work item by adding an entry to the work item history. Here is a sample tfpt command:


    tfpt workitem /update /s:<YourTeamServer> <YourWorkItemId> /fields:"History=Associated to changeset 123"



    tfpt is the Team Foundation power tool. Download for VS2008: http://www.microsoft.com/downloads/details.aspx?familyid=7574836F-4A0B-454F-A340-85DA4698177C&displaylang=en. Download for VS2005: http://www.microsoft.com/downloads/details.aspx?familyid=7324C3DB-658D-441B-8522-689C557D0A79&displaylang=en



    Hope this helps. -Tan

    Friday, March 14, 2008 12:34 PM
  • I'm trying to associate a work item during a check-in.

    The TFPT workitem approach suggests performing that separate step after doing the checkin, but my checkin is rejected as the association hasn't happened at that point.

    If I try to do the TFPT workitem step before the checkin - what is my changeset, I haven't checked anything in yet?  

    TF checkin -associate:9999 

    would have been much easier.



    Tuesday, June 17, 2014 3:58 PM
  • I realize this is a very old thread. But, this doesn't show how to actually link the changeset to the workitem. Can someone show how to actually do it? Thanks.

    Mordechai Danielov

    Monday, October 19, 2015 1:58 PM
  • Hi,

    I'm also trying to dealing with this issue because we have a policy applied on TFS Server that it don't allow to check in any item without linking to one or more work items, have you got this resolved?


    Wednesday, February 17, 2016 6:06 AM