Search code examples
visual-studio-2012msbuildtfsbuild

How to use $(OutDir) in Pre-Build Event?


$(OutDir) = \bin\Release (in local with VS2012)

$(OutDir) = C:\\...\BuildDefinition\Binaries (on TFS2010 Team Build)

How to do in a Pre-build event to write a XCOPY which works in the two cases ?

In my project2, I reference the project1. So I need to do this :

In local :

XCOPY /Y $(SolutionDir)Project1\$(OutDir)Project1.dll"

"$(SolutionDir)MyProject2\Objects\Assemblies"

On Team Build

XCOPY /Y "$(OutDir)Project1.dll" "$(SolutionDir)Project2\Objects\Assemblies"

Thank you.


Solution

  • Here is a useful build event check:

    if "$(BuildingInsideVisualStudio)" == "" 
    

    this will allow you to define a build event for when your in visual studio, not when running on TeamBuild(msbuild)