Project TargetDir on TFS build server

≯℡__Kan透↙ 提交于 2019-12-05 08:22:36

TFS and Visual Studio both use msbuild to build your solution however the folder structure of the build output is different. The reason the output is not in the same structure as VS is because the TFS build template overrides the $(OutDir) property to point to the "binaries" folder on the build agent.

In TFS 2012 / .net 4.5 you can control this behaviour by passing an msbuild argument in your build definition /p:GenerateProjectSpecificOutputFolder=true

See this blog for more info

This happens because MSBuild and TFSBuild are two different products - on your local machine MSBuild is used to build your projects.

One method I have used to get round this issue is to be a bit more verbose and use a combination of ProjectDir and ConfigurationName. Here is an actual example where I'm copying some config files:

robocopy "$(ProjectDir)bin\$(ConfigurationName)" "...target folder..." *.config

(Note that I've removed the target path, it wasn't essential to the example)

This works regardless of whether the assembly is targeted for AnyCPU or x86/64, due to Microsoft's convention of including a slash as part of the folder name.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!