.NET Framework Bookmark and Share   
 index > MSBuild > Microsoft.csharp.targets does not pass framework assembly references to csc
 

Microsoft.csharp.targets does not pass framework assembly references to csc

We recently upgraded our build server to .net 3.5 - since we are in the process of upgrading our work. Everything was going smoothly until we ran into an issue where framework references were not being passed to the csc. After looking at our Cruise Control log files - it was obvious that the @References were not being passed to the compiler (only on the build server). Below is the sample build script I am using for the purpose of testing this - is there a property that needs to be set to force the @References parameter to be sent to the CSC each time? We are extending the default build process - by importing Microsoft.csharp.targets into our build script. Thanks!

PS - I can send the Build script - but it's too big to include in this intial post.

CSC Command that works correctly (manually added references)

C:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /debug- /optimize+ /out:C:\CI\Staging\Library\tah.DataLibrary.dll /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.VisualBasic.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll" /reference:"C:\CI\Staging\Library\tah.Utilities.dll" /reference:"C:\CI\Staging\Library\Microsoft.Practices.EnterpriseLibrary.Common.dll" /reference:"C:\CI\Staging\Library\Microsoft.Practices.EnterpriseLibrary.Data.dll" /target:library C:\CI\Source\Library\DataLib\DbBroker.cs C:\CI\Source\Library\DataLib\Properties\AssemblyInfo.cs


CSC Command line that is running through CC.NET and is failing (pulled from log file):

C:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /debug- /optimize+ /out:C:\CI\Staging\Library\tah.DataLibrary.dll /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.VisualBasic.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll" /reference:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll" /reference:"C:\CI\Staging\Library\tah.Utilities.dll" /reference:"C:\CI\Staging\Library\Microsoft.Practices.EnterpriseLibrary.Common.dll" /reference:"C:\CI\Staging\Library\Microsoft.Practices.EnterpriseLibrary.Data.dll" /target:library C:\CI\Source\Library\DataLib\DbBroker.cs C:\CI\Source\Library\DataLib\Properties\AssemblyInfo.cs

rnewdev
Correction:

CSC Command line that is running through CC.NET and is failing (pulled from log file)

Target "CoreCompile: (TargetId:1)" in file "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CSharp.targets" from project "C:\CI\Source\Library\DataLib\Build\LibraryDeployment.proj":
Building target "CoreCompile" completely.
Output file "obj\Release\tah.DataLibrary.dll" does not exist.
Using "Csc" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Csc" (TaskId:7)
Command: (TaskId:7)
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /debug- /optimize+ /out:obj\Release\tah.DataLibrary.dll /target:library C:\CI\Source\Library\DataLib\DbBroker.cs C:\CI\Source\Library\DataLib\Properties\AssemblyInfo.cs (TaskId:7)
The "Csc" task is using "Csc.exe" from "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe". (TaskId:7)
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1 (TaskId:7)
for Microsoft (R) .NET Framework version 3.5 (TaskId:7)
Copyright (C) Microsoft Corporation. All rights reserved. (TaskId:7)
(TaskId:7)
c:\CI\Source\Library\DataLib\DbBroker.cs(3,14): error CS0234: The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(4,14): error CS0234: The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(5,14): error CS0234: The type or namespace name 'Web' does not exist in the namespace 'System' (are you missing an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(6,17): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(12,27): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(35,26): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(88,26): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(106,33): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(122,16): error CS0246: The type or namespace name 'DataTable' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(145,55): error CS0246: The type or namespace name 'DbTransaction' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(145,16): error CS0246: The type or namespace name 'DataTable' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(157,55): error CS0246: The type or namespace name 'DbParameter' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(157,16): error CS0246: The type or namespace name 'DataTable' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(181,55): error CS0246: The type or namespace name 'DbParameter' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(181,81): error CS0246: The type or namespace name 'DbTransaction' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(181,16): error CS0246: The type or namespace name 'DataTable' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(220,48): error CS0246: The type or namespace name 'DbTransaction' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(225,48): error CS0246: The type or namespace name 'DbParameter' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(249,48): error CS0246: The type or namespace name 'DbParameter' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(249,74): error CS0246: The type or namespace name 'DbTransaction' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(254,36): error CS0246: The type or namespace name 'DbCommand' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(278,36): error CS0246: The type or namespace name 'DbCommand' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(278,51): error CS0246: The type or namespace name 'DbTransaction' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(313,49): error CS0246: The type or namespace name 'DbTransaction' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(318,49): error CS0246: The type or namespace name 'DbParameter' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(345,49): error CS0246: The type or namespace name 'DbParameter' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(345,75): error CS0246: The type or namespace name 'DbTransaction' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(350,37): error CS0246: The type or namespace name 'DbCommand' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(376,37): error CS0246: The type or namespace name 'DbCommand' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(376,52): error CS0246: The type or namespace name 'DbTransaction' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(385,54): error CS0246: The type or namespace name 'DbParameter' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(385,16): error CS0246: The type or namespace name 'DbCommand' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(402,49): error CS0246: The type or namespace name 'DbConnection' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(402,86): error CS0246: The type or namespace name 'DbParameter' could not be found (are you missing a using directive or an assembly reference?)
c:\CI\Source\Library\DataLib\DbBroker.cs(402,23): error CS0246: The type or namespace name 'DbCommand' could not be found (are you missing a using directive or an assembly reference?)
Done executing task "Csc" -- FAILED. (TaskId:7)
Done building target "CoreCompile" in project "LibraryDeployment.proj" -- FAILED.: (TargetId:1)
Done Building Project "C:\CI\Source\Library\DataLib\Build\LibraryDeployment.proj" (AfterBuild target(s)) -- FAILED.
Project Performance Summary:
969 ms C:\CI\Source\Library\DataLib\Build\LibraryDeployment.proj 1 calls
969 ms AfterBuild 1 calls
Target Performance Summary:
78 ms _CheckForInvalidConfigurationAndPlatform 1 calls
344 ms CoreCompile 1 calls
Task Performance Summary:
0 ms Message 2 calls
312 ms Csc 1 calls
Build FAILED.
rnewdev
I'm having the same problem. Did you manage to find a solution or workaround? Tx.
Thomas Phlips

You can use google to search for other answers

Custom Search

More Threads

• Program Files(x86)
• Common output directory for all projects
• Assembly compiles to 0.0.0.0
• Use case for the Outputs parameter of the Exec task
• library configuration file not copied to referenced project
• newbie question, how to specify individual project configs at sln command line
• MSBuild does not keep attributes when compiling on network drives?
• Reference Required Error
• single thread in msbuild
• GAC an assembly with MSBUILD