using System.Linq, without reference to System.Core => compiles in VS, but not with msbuild.exe v3.5 - by jaapq42

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 665406 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 4/28/2011 2:52:02 AM
Access Restriction Public


* Convert .NET 2.0 classlibrary to .NET 3.5
* Create new class file (verify that System.Linq is added to the usings)
* Compile with VS 2010 => works
* Compile with msbuild.exe => fails on the System.Linq namespace not being referenced
Sign in to post a comment.
Posted by Dan [MSFT] on 5/4/2011 at 5:03 PM
Hi Jaapq42, I hadn't realized that you were asking MSBuild 3.5 to build the converted project. MSBuild 3.5 will try, but fail in some cases (like here) - simply because it was shipped in 2008 before VS2010 existed. You must use 4.0 (or any future versions) to build VS2010 projects, in general.
It's possible in this case you can add a reference explicitly to System.Core.

Posted by jaapq42 on 5/4/2011 at 12:44 AM
I'm building with msbuild 3.5:

Microsoft (R) Build Engine Version 3.5.30729.5420
[Microsoft .NET Framework, Version 2.0.50727.5420]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

MSBUILD : error MSB1001: Unknown switch.
Switch: /pp:out.txt

For switch syntax, type "MSBuild /help"

I haven't tried msbuild 4.0, because we don't have .NET 4.0 installed yet on our continuous integration server.
Posted by Dan [MSFT] on 5/3/2011 at 4:52 PM
I unzipped all your projects and built each in turn with msbuild.exe /t:rebuild. I used msbuild.exe 4.0 with SP1. It built successfully in all cases.
Can you please provide
(1) msbuild.exe /pp:out.txt <yourprojectthatwon'tbuildhere> then provide out.txt
(2) diagnostic verbosity logs (ie /flp:v=diag then supply msbuild.log) for this too
Posted by Helen [MSFT] on 5/2/2011 at 10:58 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by jaapq42 on 5/2/2011 at 1:52 AM
I added three zip files, but they don't show up yet...
Posted by jaapq42 on 5/2/2011 at 1:51 AM
Created a empty console app in vs2010, .net 2.0.
Converted it to .net 3.5

Added class from the new Class dialog. (notice line 3: using System.Linq)
Compiles ok in vs2010

step 3:
I used build.bat to build from commandline with msbuild.exe:

Class1.cs(3,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
Posted by Helen [MSFT] on 4/28/2011 at 8:22 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a demo project to demonstrate this issue so that we can conduct further research?

Please submit this information to us within 4 business days. We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 4/28/2011 at 3:13 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(