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