First, we create a universal BAT for getting, checking out, copying, and checking out a file.
Postbuild. bat
Rem % 1 - Source directory % 2 - Target directory % 3 - File Name
Rem writes D: \ projects \ _ commonlibrary \ postbuild. Bat $ (targetdir) D: \ projects \ _ commonlibrary \ XXX $ (targetfilename) in the generated event)
If Defined tfpath Goto Runtf
If Defined ProgramFiles Set Tfpath = % ProgramFiles % \ Microsoft Visual Studio 9.0 \ Common7 \ ide
If Defined ProgramFiles (x86) Set Tfpath = % ProgramFiles (x86) % \ Microsoft Visual Studio 9.0 \ Common7 \ ide
: Runtf
@ Echo ' Update started '
" % Tfpath % \ tf.exe " Get % 2 \ % 3
" % Tfpath % \ tf.exe " Checkout % 2 \ % 3
Copy % 1 \ % 3 % 2 \ % 3
" % Tfpath % \ tf.exe " Checkin % 2 \ % 3 / Override : Reason.txt / Noprompt
Set Tfpath =
@ Echo ' Complete '
This bat file can be used in post-project events, so that the generated dll can be automatically checked into TFs each compilation; you can also write an external BAT file to use this function.
For example, there is another copy. Bat task:
Net use \\ 192.168 . 1.5 / User: user name and password
call D: \ postbuild. bat D: \ XXX \ bin \ release D: \ YYY \ ABC. DLL
call D: \ postbuild. bat D: \ XXX \ bin \ release D: \ YYY \ ABC. PDB