【发布时间】:2011-09-14 19:17:35
【问题描述】:
我在我们的构建服务器上使用 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。 下面是产生错误的代码(第一种方法中的返回部分):
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
};
}
【问题讨论】:
-
在询问编译错误时,您肯定、肯定、肯定必须包含代码
-
您说您使用的是 VS2010 - 这是否意味着您的目标是本地 .NET 4 和 CCNet 服务器上的 3.5?
-
您是否在该 cc 任务中使用了正确的 MSBuild.exe 路径(.NET 3.5 与 .NET 4.0)?
-
它在本地和 CCNet 服务器上都用 3.5 编译。为了它,我尝试使用 4.0 进行编译。我已经用我忘记粘贴的一些代码更新了帖子...:)
标签: c# build cruisecontrol.net build-automation nant