0

I am trying to get the drop folder location for TFS within my MsBuild script for a particular project.

I have tried to use the $(DropLocation) property but this is empty. What is the best way to get the drop folder location used by TFS in an MSBuild script?

Michael Edwards
  • 6,308
  • 6
  • 44
  • 75

2 Answers2

2

If you were using TFS 2013, you have the nice TF_BUILD_DROPLOCATION environment variable at hand, which you can use just like any property.

In 2012 and earlier, you can customize the TFS Build Template: pick the BuildDetail.DropLocation property and pass the value to MSBuild. See How to pass TFS variable to a MSBuild task of the project for details.

Use TF_BUILD_DROPLOCATION as property name so you code will work when you upgrade to TFS 2013.

Community
  • 1
  • 1
Giulio Vian
  • 8,248
  • 2
  • 33
  • 41
0

(I did this in ts2010, still works with tfs2012) add to your msbuild .proj, something like this

<Project DefaultTargets="SetEnv" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />

  <PropertyGroup>
    <TeamBuildRefPath Condition="'$(TeamBuildRefPath)'==''">$(PathToMyDevenv)\IDE</TeamBuildRefPath>
  </PropertyGroup>

then the $(DropLocation) becomes populated as you'd expect.

I've a feeling you only need the import, it's been a while since I did this.

Cheers

timB33
  • 1,977
  • 16
  • 33
  • Just adding the Import statement above didn't work for me. You have to update the BuildProcessTemplate file, defaultTemplate.XAML for example, by manually adding the BuildDetail.DropLocation property to the MSBuild command line arguments. See the answer in this article for more info: http://stackoverflow.com/questions/7330353/how-to-get-buildnumber-in-proj-msbuild-using-tfs-server. – ckkkitty Mar 31 '16 at 15:00