0

有没有一种简单的方法可以打印(到文本文件).NET 项目中所有“引用”的路径?

在 IDE 中,可以看到每个路径的路径,但如果我想为项目中的所有引用打印该路径,你知道如何做到这一点吗?

谢谢。

4

1 回答 1

1

If you look at the csproj file (assuming it's a C# project you will find something like this:

<ItemGroup>
  <Reference Include="DevExpress.Data.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
    <SpecificVersion>False</SpecificVersion>
    <HintPath>..\Libs\DevExpress.Data.v10.2.dll</HintPath>
    <Private>True</Private>
  </Reference>
  <Reference Include="DevExpress.Data.v10.2.Linq, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
    <SpecificVersion>False</SpecificVersion>
    <HintPath>..\Libs\DevExpress.Data.v10.2.Linq.dll</HintPath>
    <Private>True</Private>
  </Reference>
  <!-- some more -->
</ItemGroup>

You could read the project file as a XML document and fire up some XPath queries and do a Console.Writeline.

于 2012-05-10T11:30:44.023 回答