Msbuild 4.0 refers to System.Core 4.0 when a project targets 3.5?

Msbuild works fine on my computer, but when I try to build a project using bamboo / msbuild, it refers to .net 4.0 for some reason.

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] 

I need to use MSBuild 4.0 because I use the new compiler features (default options, etc.). For some reason, System.Core 4.0 even refers to the fact that it targets 3.5.

+4
source share
2 answers

This is a known issue. Link , Link , Link , Link

I fixed it by deleting the System.Core assembly link from the project, I think (it was a long time ago).

Or try changing your project this way:

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

Make sure nothing is mentioned on the Link Paths tab of the project properties. If you want to specify the reference path to the dll here, you must make sure that the added DLL is present only once at the specified path. Empty reference paths

-1
source

Source: https://habr.com/ru/post/1401531/


All Articles