Missing reference to System.Core.dll

I have a project that was recently upgraded from VS2008 to VS2010 and then from .NET 2.0 to .NET 3.5.

When I use MSBuild on the local machine, the CSC task emits, among a long list of other references this one: "/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll".

In TeamCity, the build messages include roughly the same Csc.exe output only it is MISSING the above reference.

The result is that a file with a reference to Linq won't compile (it needs System.Core.dll)

If I copy the CSC task output from TeamCity and run it locally, I get the same error. If I add in the missing "/reference..." it runs just fine.

Locally, MSBuild is using the CSC from the 4.0 framework (C:\windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe)

TeamCity is using the CSC from the 3.5 framework (C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe)

I have tried setting the MSBuild version to 4.0 and the Tools version to 3.5 in TeamCity but then I get some odd SGEN error messages complaining about a mismatch.

My question is this: why isn't the TeamCity MSBuild 3.5 version emitting a reference to System.Core?  How can I get TeamCity to compile this project?

6 comments

What is the version of TeamCity? Please upgrade to 5.1.4 if necessary. I need the build log and the build runner settings to analyze this issue.

0

Thanks for the response:

Build is 5.1.4 (build 13550).

Settings are (I don't see any way to export these to a text file?)

BuildRunner: MSBuild

MSBuild Version: Microsoft .NET Framework 3.5

MSBuild Tools Version:3.5

Run Platform: x86

If you need other information let me know.



Attachment(s):
.NET_Eclipse_Logbook_126.log.zip
0

This was what I found in your build script:
Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5".

You may switch build runner to MSBuild v4.0 to make it work right.

0

I tried that but no go.  We roll in a legacy assembly built from Delphi that is compiled in 1.1 (yes... ugly) and the 4.0 compiler chokes when it runs SGEN.

Over the weekend I noticed an oddity that might shed some light on the issue... and also might point to this not being a TeamCity issue specifically.. .but I am not sure yet?

When I run MSBuild on my local machine (I have VS 2010 / .NET4 installed) the build works fine.  When I run it on the build machine (outside of TeamCity) I get the same errors.  The SGEN error actually makes sense to us to get (because of the Delphi / .NET assembly) but I would think we would get the same problem on my local machine... yet I don't.

We are building a 3.5 assembly so we don't need to use the 4.0 MSBuild / CSC stack though so if we can get around the issue by using the 3.5 runner that would be preferable.  It's really odd that using the 3.5 runner does not include the reference to System.Core.dll in the arguments it sends to the CSC.  If I manually add this reference to the arguments, the 3.5 version of the csc compiles without a hitch.

I tried explicitly adding a reference to System.Core.dll in the VS 2010 IDE however it won't let me do that... it says that the reference is implicit because the project is a 3.5 project.

If you have other ideas I would love to hear them... I am fresh out at the moment!

Thanks,

Matt

0

You may use .NET 4.0 MSBuild, but in project configuration in VS you may set target platform to .NET 3.5. Will that work? If that works only on your machine, please check GAC references and signing of assemblies. Could there be some assemblies that are only accessible locally?

0

That actually is what I am hoping to do (4.0 msbuild  / 3.5 target)... just getting the weird SGEN error.  It's possible that this error is leading me the wrong direction so I will go back and take another look at the MSBuild 4.0 / 3.5 target configuration and see if I can figure out why it works on my machine but not the build machine.

Both boxes are on Windows 7 but mine is 64 bit and has VS 2010 installed.  Those are the only relevant differences I can think of though I will be fine-tooth-combing them!

0

Please sign in to leave a comment.