0

我正在创建一个程序来启动一系列项目的构建。我从我的代码中调用一个批处理文件,该文件启动 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"
4

1 回答 1

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

于 2013-07-30T14:02:30.097 回答