启用“失败时创建工作项”时,TFS 2010 Build 会出现 WorkItemStore 错误
我正在使用 TFS 2010 构建。我有一个使用 TFS 2010 中现有的 DefaultTemplate.xaml 模板的生成定义,并且生成定义中的“失败时创建工作项”属性设置为 True。我故意对项目进行了更改,从而破坏了构建。
当构建运行时,我看到 Visual Studio 内的 TFS 构建日志中反映了编译错误,但当 TFS Build 接下来尝试为损坏的构建生成工作项时,我收到错误“值不能为空。参数名称:WorkItemStore” 。
我跟踪了 DefaultTemplate.xaml 中的活动(请参阅下面相当长的路径),其中为损坏的构建创建了工作项,并且我看到它使用 Microsoft.TeamFoundation.Build.Workflow.Activities.OpenWorkItem 类来创建工作项。似乎在“创建工作项”活动的“属性”窗口中填写了适当的值,因此我看不到可以将 WorkItemStore 传递给它,而且我什至不知道此设置的适当值。
“创建工作项”活动的路径:
流程>序列>运行代理>尝试编译、测试并关联变更集和工作项 >序列>编译、测试和关联变更集和工作项 >尝试编译和测试>编译和测试>对于 BuildSettings.PlatformConfigurations 中的每个配置 >编译并测试配置>如果 BuildSettings.HasProjectsToBuild >对于 BuildSettings.ProjectsToBuild 中的每个项目 >尝试编译项目>处理异常>如果创建工作项>为非搁置集构建创建工作项 >创建工作项
I'm using TFS 2010 Build. I have a build definition that uses the DefaultTemplate.xaml template that's stock in TFS 2010, and the Create Work Item on Failure property is set to True in the build definition. I deliberately made a change in my project that breaks the build.
When the build runs, I see the compilation error reflected in the TFS Build log within Visual Studio, but I get the error "Value cannot be null. Parameter name: WorkItemStore" when TFS Build next tries to generate a Work Item for the broken build.
I tracked down the activity in DefaultTemplate.xaml (see the rather lengthy path to it below) where the Work Item is created for a broken build, and I see it uses the Microsoft.TeamFoundation.Build.Workflow.Activities.OpenWorkItem class to create the Work Item. The appropriate values seemed to be filled out in the Properties window for the Create Work Item activity, so I don't see where I can pass WorkItemStore to it and I don't even know appropriate values for this setting.
Path to the Create Work Item activity:
Process > Sequence > Run On Agent > Try Compile, Test, and Associate Changesets and Work Items > Sequence > Compile, Test, and Associate Changesets and Work Items > Try Compile and Test > Compile and Test > For Each Configuration in BuildSettings.PlatformConfigurations > Compile and Test for Configuration > If BuildSettings.HasProjectsToBuild > For Each Project in BuildSettings.ProjectsToBuild > Try to Compile the Project > Handle Exception > If CreateWorkItem > Create Work Item for non-Shelveset Builds > Create Work Item
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
构建代理运行的服务帐户是否有权访问团队项目中的工作项?这可能是
WorkItemStore
对象为 null 的原因。通常,构建代理服务帐户会添加到“项目集合构建服务帐户”组中,该组已对每个团队项目具有此访问权限。但是,如果您自定义了流程模板、您的组/权限或未正确设置构建代理 - 那么权限可能不正确。
Does the service account that the build agent runs as have access to work items in the team project? This can be a reason why the
WorkItemStore
object would be null.Normally build agent service accounts are added to the "Project Collection Build Service Accounts" group that already has this access on every team project. However, if you have customized the process template, your groups/permissions or not setup the build agents correctly - then the permissions might not be correct.