与下面的代码类似的c ++ / cli代码片段导致我们的TFS构建因C2360编译器错误而失败。
switch (i)
{
case 0 :
for each (int n in a)
System::Console::WriteLine(n.ToString());
break;
case 1 :
System::Console::WriteLine("n is not in scope here");
break;
}
通过在case 0的主体内使用{}括号来修复此问题,如下所示:
switch (i)
{
case 0 :
{
for each (int n in a)
System::Console::WriteLine(n.ToString());
}
break;
case 1 :
System::Console::WriteLine("n is not in scope here");
break;
}
开发人员在提交更改之前已在其桌面上成功编译了代码。
粗略地看一下服务器和桌面上的编译器,Visual Studio等版本,看它们是相同的。
显然,源代码是相同的。
桌面构建和TFS构建之间有什么区别可以扼杀像这样的编译器错误?