开发者

Force VS2010 to keep the build output path absolute

开发者 https://www.devze.com 2023-01-05 20:01 出处:网络
We want to have our build server send the output of each build to C:\\Projects\\{project name}\\build\\{build configuration}\\.

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 Tea开发者_如何学CmCity, 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?


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


You can not convince IDE to use absolute path, but you can change the Project file:

<OutputPath>C:\Dir1\Dir2</OutputPath>

Your IDE will still show relative path but it will store the absolute path.

Works for me with Visual studio 2010 Sp1

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号