我正在创建一个程序来启动一系列项目的构建。我从启动Visual Studio 2010命令提示符的代码中调用一个批处理文件,并根据我选择构建的项目执行各种tfsbuild开始命令。我指定了以下参数:TFSBuild start/collection:http:// [myServer]:8080 // builddefinition:“myProject/myBuildDefinition”。执行批处理文件后,我得到以下错误,但我回到TFS中,构建开始并成功。tfsBuild在开始构建时抛出异常,但仍然构建
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"
请张贴的代码。 – Isaiah4110
我添加了我使用的代码。 –
发布您正在调用BAT文件的整个C#代码/方法。我不认为这与bat文件或TFSBUILD启动命令有关。它在你的C#代码中。 – Isaiah4110