在我們的構建服務器上使用NAnt和CCNet。最近當我一直在做本地部署時,我得到了似乎與Linq,泛型和代表連接的構建錯誤。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
};
}
你一定,一定,一定要包括代碼詢問一個編譯錯誤 – 2011-06-14 15:11:37
當你說你'使用VS2010 - 這是否意味着你在CCNet服務器上本地定位了.NET 4,3.5? – Rup 2011-06-14 15:13:02
你在那個cc任務中使用MSBuild.exe(.NET 3.5 vs .NET 4.0)的正確路徑嗎? – BrokenGlass 2011-06-14 15:13:28