我最近尝试将以下msbuild参数添加到VSO Build vNext中的Visual Studio Build定义中。
/p:GenerateBuildInfoConfigFile=True /p:IncludeServerNameInBuildInfo=True
这样做是为了自动生成<ProjectName>.BuildInfo.config
以便以后使用Application Insights
但是,运行任务时,会创建以下警告:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\BuildInfo\Microsoft.VisualStudio.ReleaseManagement.BuildInfo.targets(147,5): Warning : Following information could not be added to build information because there was an error while communicating with TFS: BuiltSolution. Error: TF30063: You are not authorized to access https://<account>.visualstudio.com/defaultcollection..
生成的BuildInfo.config缺少项目集合URL以外的任何TFS相关信息:
<?xml version="1.0" encoding="utf-8"?>
<DeploymentEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/VisualStudio/DeploymentEvent/2013/06">
<ProjectName>Project.Name</ProjectName>
<SourceControl type="TFS">
<TfsSourceControl>
<ProjectCollectionUri>https://account.visualstudio.com/DefaultCollection/</ProjectCollectionUri>
</TfsSourceControl>
</SourceControl>
<Build type="MSBuild">
<MSBuild>
<BuildLabel kind="label">AutoGen_2bf2bd5c-f895-4b35-be2f-e31a06088ea1</BuildLabel>
<BuildId kind="id">AutoGen_2bf2bd5c-f895-4b35-be2f-e31a06088ea1</BuildId>
<BuildTimestamp kind="informative, summary">Wed, 07 Oct 2015 08:30:21 GMT</BuildTimestamp>
<BuildMachine kind="informative">TASKAGENT-0007</BuildMachine>
<Configuration kind="informative">Debug</Configuration>
<Platform kind="informative">AnyCPU</Platform>
</MSBuild>
</Build>
</DeploymentEvent>
除了<TfsSourceControl>
ProjectItemSpec
部分还有ProjectVersionSpec
和ProjectCollectionUri
问题:
如何将托管代理授权给项目集合?请注意,在构建配置的常规部分中,Build job authorization scope
已设置为Project Collection
。
替代地
有没有更好的方法来处理VSO中BuildInfo.config的生成?