Linq导致生成错误
|
我在构建服务器上使用NAnt和CCNet。最近,当我一直在进行本地部署时,出现了似乎与Linq,泛型和委托有关的构建错误。
结果如下:
[nant] C:\\Test\\buildfiles\\build.build
Buildfile: ..........
Target framework: Microsoft .NET Framework 3.5
Target(s) specified: build
build:
[csc] Compiling 192 files to \'C:\\TEST\\bin\'.
[resgen] Read in 78 resources from \'C:\\Test\\Resources\'.
[csc] c:\\Test\\src\\randomfile.cs<10,10>: error CS0411: The type arguments for method \'System.Linq.Enumerable.Select<TSource,TResult><System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,TResult>>\' cannot be inferred from the usage. Try specifying the type arguments explicitly
在我的机器上,我可以毫无问题地进行构建(vs2010)。我正在使用最新的NAnt 0.91b。
更新:
该项目具有目标框架3.5。
下面是生成错误的代码(第一种方法的return部分):
public static RoleTypeIdAndName[] TranslateRoleTypes(RoleType[] roleTypes)
{
return roleTypes.Select(TranslateRoleType).ToArray();
}
public static RoleTypeIdAndName TranslateRoleType(RoleType roleType)
{
return new RoleTypeIdAndName
{
Name = roleType.Name,
RoleTypeId = roleType.RoleTypeId
};
}
没有找到相关结果
已邀请:
2 个回复
告耸
是
臂哦