dllvisual-studio-2013tfstfs-2015vbc

TFS 2015 reference required to assemby


I've a problem with a build with TFS 2015.

I've a simple project that reference B.dll . B.dll use A.dll . The project don't reference A.dll as it don't use it itself.

A.dll & B.dll bothe are company Framework dll stored in the GAC.

[error]LogistiqueTest\Index.aspx.vb(7,14): Error BC30009: Reference required to assembly 'A.DII.Technique.Interfaces, Version=3.5.0.0, Culture=neutral, PublicKeyToken=e60618ca32d203a8' containing the implemented interface 'A.DII.Technique.Interfaces.IGestionException'. Add one to your project.

This is not a big deal, just a reference that's missing. But we don't want to add unecessary references in our projects Moreover, this problem don't occurs with visual studio (2013 pro)

So I tracked the problem and I saw that : -> Visual studio retrieve quickly the reference (A.dll) after the "call" of this line

Target "CoreBuild: (TargetId:61)" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "D:\AgentTFS_02_work\3\s\LogistiqueTest\LogistiqueTest.vbproj" (target "Build" depends on it):

But TFS don't use the same file; it use

"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets"

The difference between those files is in Microsoft.Common.CurrentVersion.targets, there is some code for resolving assemblies.

So my questions are, is there a way to make TFS build my solution visual studio like ? Force the other target file to be used? Is there another trick to be able to resolve this assembly ?

I tried to add, like i saw in many post around the web, a folder that contains every .dll required, but TFS don't event try to resolve path for A.dll

More information : The exception occurs at the execution of Vbc.exe because with VS execution the command line has A.dll in the /import section when with TFS it's not added. No problems with MSBuild.exe.


Solution

  • I finally found an anwser :

    http://www.nsilverbullet.net/2012/02/17/automatically-resolving-secondary-assembly-references-with-msbuild-and-tfs-build/

    I need to add this to the proj file that has problems.

    <Target Name="AfterResolveReferences">
        <!-- Redefine referencepath to add dependencies-->      
          <ItemGroup>
              <ReferencePath Include="@(ReferenceDependencyPaths)"></ReferencePath>
              </ItemGroup>
    </Target>