NDepend获取解决方案中每个项目的第三方参考

时间:2015-05-14 15:25:04

标签: ndepend

对于我的解决方案中的每个项目,我想获得它使用的第三方程序集的列表。

我猜是这样的:

    let landscapeAssemblies = from a in JustMyCode.Assemblies
    let thirdPartyAssemblies = from a in ThirdParty.Assemblies

    select new { landscapeAssemblies, thirdPartyAssemblies.UsedBy(landscapeAssemblies) }

但是(像我的大多数ndepend查询一样)我收到错误“不完整查询” - 我不知道该查询是如何完成的。

我想要归还的是:

Project1 :
          Third Party Assembly 1
          Third Party Assembly 2
          Third Party Assembly 3
Project2:
          etc
          etc

我该怎么做?

1 个答案:

答案 0 :(得分:1)

此查询是否符合您的需求?

from a in Application.Assemblies
let thirdPartyAsmUsed = ThirdParty.Assemblies.UsedBy(a)
select new { a, thirdPartyAsmUsed } 

Third-Party assemblies used by each application assembly

有点精明,当你处于diff模式时,你可以要求你的应用程序的每个程序集,自diff diff基线以来新使用的第三方程序集:)

from a in Application.Assemblies
where a.IsPresentInBothBuilds()
let thirdPartyAsmUsedNew = ThirdParty.Assemblies.UsedBy(a)
let thirdPartyAsmUsedOld = codeBase.OlderVersion().ThirdParty.Assemblies.UsedBy(a.OlderVersion())
let thirdPartyAsmNewlyUsed =  thirdPartyAsmUsedNew.Except(
                 thirdPartyAsmUsedOld.Where(m=> m.IsPresentInBothBuilds()).Select(m => m.NewerVersion()))
select new { a, thirdPartyAsmUsedNew, thirdPartyAsmUsedOld, thirdPartyAsmNewlyUsed }

Third Party assemblies newly used by each application assembly