组装所需的 TFS 2015 参考

TFS 2015 reference required to assemby

我在使用 TFS 2015 构建时遇到问题。

我有一个引用 B.dll 的简单项目。 B.dll 使用 A.dll 。该项目不引用 A.dll,因为它本身不使用它。

A.dll & B.dll 这两个是存储在 GAC 中的公司框架 dll。

[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.

这没什么大不了的,只是缺少一个参考。但是我们不想在我们的项目中添加不必要的引用 此外,visual studio (2013 pro)

不会出现此问题

所以我跟踪了这​​个问题,我看到了: -> Visual studio 快速检索此行 "call" 之后的引用 (A.dll)

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

但是TFS不使用同一个文件;它使用

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

这些文件的区别在于Microsoft.Common.CurrentVersion.targets,其中有一些用于解析程序集的代码。

所以我的问题是,有没有办法让 TFS 像 visual studio 一样构建我的解决方案?强制使用其他目标文件?还有其他技巧可以解决此程序集吗?

我试图添加一个文件夹,就像我在网上看到的许多 post 一样,其中包含所需的每个 .dll,但 TFS 不会尝试解析 A.dll

更多信息:执行Vbc.exe时出现异常 因为在执行 VS 时,命令行在 /import 部分中有 A.dll,而在使用 TFS 时未添加。 MSBuild.exe.

没问题

终于找到答案了:

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>