locked
Can I execute a task that perform edits on a file being checked in? RRS feed

  • Question

  • Is it possible -- with either Visual Studio 2008 or VS2010 --  to add a custom check-in task that performs an edit (string substitution) on a source file that is being checked into TFS source control?    This is something we would like to do when checking in .csproj files.

    It doesn't matter whether the task is a .NET assembly or a Powershell script ... either would be satisfactory.

    If it is possible, could you please point me in the direction of some documentation that describes how this can be done.

     

    Thanks,

    Mike

    Friday, April 16, 2010 4:05 PM

Answers

  • Hi Mike,

    TFS provides check-in policy that can be used to define your actions before check-in pending changes. The general purpose for check-in policy is to check if the check-in is valid or not. However, it is also possible that you can change the local items before checking in.

    First, please follow the MSDN article to create a check-in policy and deploy it: http://msdn.microsoft.com/en-us/library/bb668980.aspx

    Then, iterate the pending changes and find the local item path. Get the file you needed and change it.

    Hope it helps.

     


    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    See what's happening in MSDN forum? Follow us at Twitter.
    • Marked as answer by mkedwards Monday, April 19, 2010 2:20 PM
    Monday, April 19, 2010 8:21 AM

All replies

  • Hi Mike,

    TFS provides check-in policy that can be used to define your actions before check-in pending changes. The general purpose for check-in policy is to check if the check-in is valid or not. However, it is also possible that you can change the local items before checking in.

    First, please follow the MSDN article to create a check-in policy and deploy it: http://msdn.microsoft.com/en-us/library/bb668980.aspx

    Then, iterate the pending changes and find the local item path. Get the file you needed and change it.

    Hope it helps.

     


    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    See what's happening in MSDN forum? Follow us at Twitter.
    • Marked as answer by mkedwards Monday, April 19, 2010 2:20 PM
    Monday, April 19, 2010 8:21 AM
  • Thanks, Hongye.   Just what I needed to know.

    Mike

     

    Monday, April 19, 2010 2:19 PM