Question

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.

Was it helpful?

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

OTHER TIPS

"$(DevEnvDir)tf" is the solution I was looking for - which is really just another way of solving the same problem.

It's simple and generic. More desirable, I think.

I think this is also more suitable for teams, and doesn't need to be changed if the project gets upgraded to another version of VS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top