views:

25

answers:

1

We want to have our build server send the output of each build to
C:\Projects\{project name}\build\{build configuration}\.

To accomplish this, I set the Build Output path property for my projects to that in Visual Studio 2010, and build locally to make sure everything works. When I do so, visual studio changes the path to a relative one, for example ..\..\build\Debug.

Since the project directory is not the same on the build server (we use TeamCity, so the project url there is something like C:\BuildAgent\work\9358A92GF92), the output doesn't end up where we want it.

How do I make Visual Studio not change the build output paths to relative paths?

A: 

You cannot convince the IDE to make it absolute. Possible solutions:

  1. Use a post-build event to xcopy the build output
  2. It won't make the path relative if the output directory is on another drive. You could use the SUBST command to map a drive letter like z: to a folder on c: and fool the IDE that way
  3. Run msbuild.exe directly on the build machine. Use the /p command line option to force the OutDir property to another value.

Solution 3 is probably best since you can make it specific to the build machine without tinkering with the project files and make the devs' lives difficult. The command should look similar to this:

 msbuild /p:outdir=c:\mumble\ projectOrSolutionFileName

Beware that the output directory name must end with a trailing backslash

Hans Passant
Adding the command line argument to the build configuration in TeamCity did the trick. Thanks!
Tomas Lycken
This wasn't helpful? How strange.
Hans Passant