2012-03-15 84 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

相關問題