tfsBuild在启动构建时抛出异常,但仍然构建

时间:2013-07-29 14:25:33

标签: exception command-line build tfs tfsbuild

我正在创建一个程序来启动一系列项目的构建。我从我的代码中调用批处理文件,启动visual studio 2010命令提示符,并根据我选择构建的项目执行各种tfsbuild Start命令。我指定以下参数:TFSBuild start / collection:http:// [myServer]:8080 // builddefinition:“myProject / myBuildDefinition”。执行批处理文件后,我收到以下错误,但我回到TFS,构建开始并成功。

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
   at Microsoft.TeamFoundation.Build.Client.InformationNodeConverters.GetBuildSt
eps(IBuildInformation buildInformation)
   at Microsoft.TeamFoundation.Build.CommandLine.CommandStart.build_StatusChange
d(Object sender, StatusChangedEventArgs e)
   at Microsoft.TeamFoundation.Build.CommandLine.CommandStart.Run()
   at Microsoft.TeamFoundation.Build.CommandLine.BuildCommandLine.RunCommand(Str
ing commandName, String[] args, Boolean& showExitCode)
   at Microsoft.TeamFoundation.Client.CommandLine.RunCommand(String[] args)
   at Microsoft.TeamFoundation.Client.CommandLine.Run(String[]& args)
   at Microsoft.TeamFoundation.Build.CommandLine.BuildCommandLine.Main(String[]
args)

有人知道这个问题吗?我打电话给tfsBuild时错过了一个参数吗?

[使用C#代码]

private void _buildButton_Click(object sender, EventArgs e)
    {
        if (_selectedProjectFolder.Equals("ProjectA"))
            Process.Start(@"N:\Build batch files\ProjectA_Build.bat");

        else if (_selectedProjectFolder.Equals("ProjectB"))
            Process.Start(@"N:\Build batch files\ProjectB_Build.bat");

        else if (_selectedProjectFolder.Equals("ProjectC"))
        {
            if (_build32RadioButton.Checked == true)
                Process.Start(@"N:\Build batch files\ProjectC_Build_32.bat");

            else if (_build64RadioButton.Checked == true)
                Process.Start(@"N:\Build batch files\ProjectC_Build_64.bat");
        }            
    }

[批处理文件内容]

Call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
TFSBuild start /collection:http://[MyServer]:8080/ /builddefinition:"MyProject/MyBuild"

1 个答案:

答案 0 :(得分:0)

问题是由“ InformationNodeConverters.GetBuildSteps(IBuildInformation) ”方法引起的,当它与较新版本的TFS服务器通信时。

请注意,在Visual Studio Team System 2008 Team Foundation Server之后不再使用构建步骤,并且已使用各种新信息节点类型(包括IBuildMessage,IBuildError,IBuildWarning和IActivityTracking)替换构建步骤。因此,此方法通常在与运行较新版本的服务器(例如,Team Foundation Server 2010)进行通信时返回空列表

http://msdn.microsoft.com/en-us/library/ff734692(v=vs.100).aspx