TFS 2015 reference required to assemby

时间:2017-04-06 16:52:57

标签: dll visual-studio-2013 tfs tfs2015 vbc

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.

1 个答案:

答案 0 :(得分:0)

我终于找到了一个anwser:

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

我需要将它添加到有问题的proj文件中。

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