$(TeamBuildConstants)对于TFS构建为空白 [英] $(TeamBuildConstants) is blank for TFS builds

查看:74
本文介绍了$(TeamBuildConstants)对于TFS构建为空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似这样的发布后活动:

I have a post build event like this:

如果不是"$(TeamBuildConstants)" =="_ TEAM_BUILD_""$(SolutionDir)Tools \ NuGet.exe"包"$(ProjectDir)MyAssembly.nuspec" -BasePath"$(ProjectDir)$(OutDir)."

if NOT "$(TeamBuildConstants)"=="_TEAM_BUILD_" "$(SolutionDir)Tools\NuGet.exe" pack "$(ProjectDir)MyAssembly.nuspec" -BasePath "$(ProjectDir)$(OutDir)."

如果"$(TeamBuildConstants)" =="_ TEAM_BUILD_""$(SolutionDir)Tools \ NuGet.exe"包"$(ProjectDir)MyAssembly.nuspec" -BasePath"$(OutDir)."

if "$(TeamBuildConstants)"=="_TEAM_BUILD_" "$(SolutionDir)Tools\NuGet.exe" pack "$(ProjectDir)MyAssembly.nuspec" -BasePath "$(OutDir)."

当我在Visual Studio中构建时,$(TeamBuildConstants)是空白的(应该是空白).

When I build on in Visual Studio $(TeamBuildConstants) is blank (as it should be).

但是当我在TFS 2010 Server上构建时,$(TeamBuildConstants)仍然为空.当我运行TFS Build时,我该怎么办?

But when I build on my TFS 2010 Server, $(TeamBuildConstants) is still blank. What do I need to do to tell when I have a TFS Build running?

推荐答案

团队建设

http://social.msdn.microsoft.com/Forums/zh-CN/tfsbuild/thread/618392e6-a108-4e70-898b-52ee6afc0600/

TeamBuild 2008为由构建代理运行的构建设置IsDesktopBuild = false.默认值(如果未在命令行上或通过项目属性设置)为true. TFS 2010的行为是相同的,因此请尝试执行以下操作:

TeamBuild 2008 sets IsDesktopBuild=false for builds run by a build agent. The default (if not set on the command line or by a project property) is true. The TFS 2010 behavior is the same, so try something like:

<PostBuildEvent Condition=" '$(IsDesktopBuild)' == 'true' ">echo This is post-build</PostBuildEvent>

尽管我从某些人那里听说它不起作用,但是还有一个替代属性-$(BuildingInsideVisualStudio)-可能可以代替.

Although I have heard from some people that it doesn't work, and there is an alternative property - $(BuildingInsideVisualStudio) - which may work instead.

如果两者都不起作用,则可能需要编辑构建定义并自己定制msbuild调用.

If neither work you may need to edit your Build Definition and customize the msbuild call yourself.

NuGet 1.6

NuGet 1.6还具有一个msbuild文件,可以创建可能值得一看的nuget文件.

NuGet 1.6 also has an msbuild file that can create nuget files which may be worth looking at.

代码段

<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
<BuildCommand>"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>

这篇关于$(TeamBuildConstants)对于TFS构建为空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆