Search code examples
visual-studiovcs-checkout

VS 2012 - Checkout on Pre-Build Does Not Occur


My pre-build event script starts by checking a file, then modifying that file by running another tool. But the tool fails to update my file because the checkout doesn't occur/complete. Why?

Here is an example of my script:

tf checkout $(ProjectDir)MyFileToCheckout.cs
mytool.exe /argument:MyFileToCheckout.cs

At the moment, I have to manually checkout the file in Visual Studio, then build.


Solution

  • The problem is that tf.exe is not in the windows path, and when visual studio tries to run the command windows does not know where to look for it.

    so either..

    A) Change your path to include the path to tf.exe (its in your visual studio folder)
    B) Change your build command to include the full path to tf.exe

    "C:\program files (x86)\microsoft visual studio 11.0\Common7\IDE\tf.exe" checkout $(ProjectDir)MyFileToCheckout.cs