I recently answered a posting by Paul Fedory in the MSDN Build Automation forum that described a situation in which his projects were using mapped drives for storage of intermediate files and the build was failing under Team Build even though the build worked from the command-line. This problem looked an awful lot like a problem my team encountered a while back when we started using mapped drives for our references. I blogged about how we used the mapped drive to help us deal with dependencies in our builds between Team Projects, but I don’t think that the posting would come up on a Google search for the mapped drive problem, so I’m going to make this post a little more descriptive.
Hi, I’m having some trouble getting my auto-generated Team Build going. So far I’ve only changed some of the inherited ‘skip’ properties to true (ie. skipclean, skipget).
I get an error when MSBuild runs vcbuild.exe on my VC++ project file. It can’t create the directory for the intermediate files. This directory is stored on another disk (the J drive), which happens to be just a shared folder on my C drive mapped to a network drive (the J drive). The Team Build Service is logged on as myself, on my computer. The permissions on this shared intermediate directory are fine (shouldn’t the team build service running as me be able to create any directory it wants?)
When I try running this vcbuild.exe command as it is in the build log snippet below, it works fine from the command line. And the directory is not write-protected. Is there some issue with accessing drives on the same computer from a service I’m not aware of, or do I need to update some workspace mappings?
Here’s a snippet from my build log:
C:Program FilesMicrosoft Visual Studio 8Common7IDE….vcvcpackagesvcbuild.exe /override:”C:[BuildPath]BuildTypeTFSBuild.vsprops” “C:codeintermediate[BuildPath]Sources[Project]LIBL2cvt32.vcproj” “Release|Win32”
L2CVT32 : warning PRJ0009: Build log could not be opened for writing.
L2CVT32 : error PRJ0007: Could not create output directory ‘j:intermediatel2cvt32rel32’.
L2CVT32 : error PRJ0006: Could not open the temporary file ‘j:intermediatel2cvt32rel32RSP0000013996732.rsp’. Make sure the file exists and that the directory is not write-protected.
Project : error PRJ0003: Error spawning ‘/O2’.
Done building target “L2CVT32” in project “LIB.sln” — FAILED.
Issue: When utilizing a mapped drive in your build, access errors occur when run under Team Build even if the build service account has full rights to the mapped folder.
Problem: The problem lies in how the mapping is created. Drive mappings are only created during “interactive” sessions.
Solution: To have the mapping persist so that the Team Build Service can use it, the SUBST command must be run using the System account on the machine.
Our Implementation of the Solution: One of our devs built a little command line app that loads itself as a service that runs on startup. This service runs SUBST.EXE under the System account to make the mapping available to our builds. We use this little tool on all of our developer and build machines.