TFS Check-in Policy - Force a shell command to have been run

萝らか妹 提交于 2019-12-24 11:29:46

问题


On the project that I'm currently working I have a requirement to run a shell command over some static files prior to check-in into TFS.

Is it possible to use TFS checkin policies to force a developer to run a shell script prior to check-in?


回答1:


Check-in Policies are designed for this purpose: to check for something in order to "authorize" the check-in.

You'll find an interesting video here about how to develop one. You'll see that it's really easy and once you did your first you will want to customize more TFS.

In you case you will have two options (IMHO):

  1. Run the shell command in the Evaluate method of the check-in policy.
  2. Make the check if the user manually ran the shell command in the Evaluate method.

The first should be the best but it bothers me a bit because it's not the true purpose of the check-in policies to perform a task upfront, but I can't think about why it shouldn't work. And maybe you'll have to go that way it the second solution is not possible.




回答2:


In the end we didn't need to use a Checkin policy.

Instead we turned the resolution on its head as I found that running tf.exe checkin from a command prompt, without any further arguments, causes the TFS checkin dialog to popup.

This means that we can add an additional step at the end of our shell script that runs:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe checkin


来源:https://stackoverflow.com/questions/11039661/tfs-check-in-policy-force-a-shell-command-to-have-been-run

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!