views:

209

answers:

1

Can anyone shed any light on how the CoreCompile task in TFS2010 (RC) Microsoft.TeamFoundation.Build targets generates the assembly references that are passed to csc.exe?

We are seeing references to both version 2.0 and 4.0 of System.Xml.dll (shown in bold below), however we are using the 'Specific Version: true' flag on the project assembly reference and there are no references to the 4.0 assembly in the btproj file:

C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /platform:x86 /errorreport:prompt /warn:4 /define:TRACE 
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll 
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll 
**/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll** 
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll 
**/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Xml.dll** 
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.dll 
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Web.Services.dll 

Update: I've checked the output of the ResolveAssemblyReferences target (from Microsoft.Common.targets) and can see that only the assemblies referenced in the project (i.e. the 2.0 framework assemblies) are included in the item list *'_ResolveAssemblyReferenceResolvedFiles'*:

ResolveAssemblyReferenceResolvedFiles:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll;
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll;
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll

However, the CoreCompile target still includes the 4.0 assemblies as detailed above.

Update 2: Ok, I've tracked this down to an obscure bug in the AddBizTalkHiddenReferences target in the BizTalk build scripts. This particular target attempts to add additional assemblies, including the ones that are duplicated above.

However, it uses the GetCORSystemDirectory from 'mscoree.dll' which returns the installation directory of the common language runtime (CLR) that is loaded into the process, in this case the 4.0 framework loaded into MSBuild; as a result, the helper doesn't think it has the System.Xml assembly referenced and adds it, hence the duplicate.

+1  A: 

Reference assemblies are resolved by ResolveAssemblyReferences target in the file Windows\Microsoft.NET\Framework\$(Version)\Microsoft.Common.targets based on the Reference items defined in your project file.

madgnome