How to get TFS build to copy correctly referenced Assembly DLL? RRS feed

  • Question

  • I have a WCF Service project (MainService) that refences an Assembly DLL Version 1 in the project sub-folder /OldLibs/.  I have another project, a Service Host Project that references the Service project I mentioned first.  The DLL is copied correctly in the Visual Studio build but, when run through TFSBuild it copies the Version 2 of the DLL with the same name from a shared Binaries directory that is not referenced in the project.  Below is the structure of the project.

     - References MainService

        Assembly1.DLL - Version 1

               - Assembly1.DLL - Version 1 is referenced to /OldLibs/ in this project

       Assembly1.DLL - Version 2


         Assembly1.DLL - Version 2 

      I would expect Assembly1.DLL - Version 1 to be copied to /bin/.

    Any thoughts?

    Wednesday, May 12, 2010 7:26 PM


  • Hi,

    How did you refer to the Assembly1.dll in HostService?

    When TFSBuild builds a project that has a assembly reference, it will try to get the reference in the  HintPath defined in the project file(*.csproj) first, then in GAC and additional reference path.

      <Reference Include="ClassLibrary, Version=, Culture=neutral, processorArchitecture=MSIL">
      <Reference Include="System" />
      <Reference Include="System.Core">
      <Reference Include="System.Xml.Linq">
      <Reference Include="System.Data.DataSetExtensions">
      <Reference Include="System.Data" />
      <Reference Include="System.Xml" />

    In your scenario, TfsBuild failed to get the assembly1.dll in the path, so it got the one in shared folder.

    To fixed this,

    First, map HostService and MainService  in your workspace with the correct structure. So that when you refer to assembly1.dll, the project will use the relative path in  HintPath

    Then, make sure the workspace of the build definition is the same as your local structure.

    Best regards,
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com
    Thursday, May 13, 2010 1:09 AM