How can one determine if a csproj is being run on a TFS build agent?

前端 未结 4 1794
小鲜肉
小鲜肉 2021-02-07 19:31

We use TFS 2010.

There are a couple of projects with deployment steps which must know whether they are running on a dev machine or on the TFS build agent.

Right

4条回答
  •  时光取名叫无心
    2021-02-07 20:05

    You have a few options:

    1. '$(BuildingInsideVisualStudio)' != ''
    2. '$(TeamBuildConstants)' != '' (supported in team Build 2008)
    3. '$(IsDesktopBuild)' == 'false'
    4. '$(tf_build)' != '' (supported in recent versions of Azure Pipelines)

    You can check either one to detect the context the task has been executed in. If both don't evaluate then MsBuild has been called from the commandline or some other process.

提交回复
热议问题