Reputation: 4628
It it my understanding that it is still the simplest to use the <Exec \>
MSBuild task and shell to TF.exe in order to TFS command line during MSBuild, especially if you don't want to create a dependency on custom build tasks or extension packs etc. (see Checkout from TFS with MSBuild)
Given that, what is the best path to use for tf.exe especially since different developers may have TFS2010 or TFS2012 mixed with VS2010 and VS2012 and also mixed with 64-bit workstations.
Is there parhaps a variable / path standard way to call the TF.exe command from MSBuild regardless of VS or TFS version?
Upvotes: 0
Views: 2192
Reputation: 4628
tbergstedt has a solution is likely more robust and can be adapted to other problems too. I did discover that there is a shortcut for this, since the TF.exe executable is also in the Developer Environment path $(DevEnvDir). See below:
<PropertyGroup>
<TfCommand>"$(DevEnvDir)\tf.exe"</TfCommand>
</PropertyGroup>
Upvotes: 3
Reputation: 3419
You can see if a system is 64-bit by looking for the ProgramW6432
environment variable.
And as long as users have chosen the default install path, TF.exe is still installed in the 32-bit part of Visual Studio even for VS2012. So the only thing you should need to look for is whether the user has 2012 or 2010 installed. That should be possible with the Exists
condition:
<PropertyGroup>
<ProgramFiles32 Condition="$(ProgramW6432) != ''">$(PROGRAMFILES) (x86)</ProgramFiles32>
<ProgramFiles32 Condition="$(ProgramFiles32) == ''">$(PROGRAMFILES)</ProgramFiles32>
<VS10Dir>$(ProgramFiles32)\Microsoft Visual Studio 10.0</VS10Dir>
<VS11Dir>$(ProgramFiles32)\Microsoft Visual Studio 11.0</VS11Dir>
<TF Condition="Exists('$(VS10Dir)')">"$(VS10Dir)\Common7\IDE\TF.exe"</TF>
<TF Condition="Exists('$(VS11Dir)')">"$(VS11Dir)\Common7\IDE\TF.exe"</TF>
</PropertyGroup>
...
<Exec Command="$(TF) checkout ..."></Exec>
Upvotes: 4