Q: Want to include subst command before doing build on build server TFS I am trying to automate the builds for our software. We have 2 category of softwares, one is containing all project in C# and other on c++. All the solutions of c# projeects are in different branch. we have automated builds for C# solutions, each check-in builds and creates the binaries of all C# projects. However, C++ projects is kind of manual process so we are trying to automate it. But the problem is that all c++ projects contains relative path for the header files they refer. hence before compiling the projects we need to map the root directory to some drive. Suppose all our source code lies in C:\software2\ then we need to subst C:\software2\ with K: drive ( any other drive ) before proceeding. and should open the compilation project from K: drive only, otherwise it would not compile.
My difficulty is that when we move our c++ projects to Team Foundation server for automation builds then following thing happens. All the source code is copied over to build agent server. from there it runs the projects and generates the binaries. So, how I modify the build definition\ template such that after copying the source it maps that path and starts compilation from that mapped drive only. Any help is appreciated.

A: I just accomplished this recently with a custom activity placed inside the build template. 
Use the activity to subst the directory and insert the drive in the "sourcesdirectory" field of the workspace creation. 
<namespace:activity DisplayName="Creating Subst's here"/>

<mtbwa:CreateWorkspace ......... SourcesDirectory="[&quot;Z:\&quot;]">

Sorry I can't go into more detail. Hope this helps!
