2012-03-15 101 views
4

Msbuild在我的计算机上工作正常,但是当我尝试使用bamboo/msbuild构建项目时,出于某种原因,它引用了.net 4.0。当项目目标为3.5时,Msbuild 4.0引用System.Core 4.0?

DB\DbExt.cs(95,42): error CS0433: The type 'System.Func<T1,T2,TResult>' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll' and 'c:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll' [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GITEXP-GITEXPORT-JOB1\NotMissing\NotMissing\NotMissing.csproj] 

我需要使用MSBuild 4.0,因为我正在使用新的编译器功能(默认参数等)。由于某些原因System.Core 4.0被引用,即使它的目标是3.5。

+0

它是唯一的项目,并没有引用任何4.0程序集。另外它使用msbuild 4.0在竹子之外建造良好。 – Will 2012-03-15 07:02:21

+0

使用供应商的支持渠道,如https://answers.atlassian.com/ – 2012-03-15 17:07:18

回答

6

这是已知问题。 LinkLinkLinkLink

我从项目移除System.Core程序集的参考固定它,我认为(这是很久以前的事)。

或者尝试修改你的项目是这样的:

<Reference Include="System.Core"> 
    <RequiredTargetFramework>3.5</RequiredTargetFramework> 
</Reference> 
+0

原来它无法找到.net 3.5客户端配置文件。所以由于某种原因,而不是默认为3.5,它默认为4.0。至少这是我现在的猜测。我尝试安装客户端配置文件,但仍无法找到它。 – Will 2012-03-15 17:48:04

+0

另一种选择是安装.NET 4.5并使用MSBuild 4.5版本而不是4.0。我猜应该在4.5中修正。 – Ludwo 2012-03-15 17:52:39

+0

谢谢,添加要求的参考元素固定它。 – Will 2012-03-16 04:32:13

-1

确保有项目属性的参考路径选项卡只字不提。如果你想在这里提到dll的参考路径,你应该确保你所添加的dll在前面提到的路径中只出现一次。 Empty Reference Paths

相关问题