Can I search by a reference name, solution-wise, to see in which projects it was referenced?

与世无争的帅哥 提交于 2019-12-24 06:36:23

问题


Is there any possibiliy to searh the whole solution to see a particular refrence's usage?

Let's say, can I see in what projects the reference "Xyxyxyxy.dll" is referenced?

(ReSharper based answers are also acceptable! :) )

Thanks!


回答1:


You can do this through notepad++ quite easily by giving the solution directory and *.csproj as the filter i.e. searching the csproj files for the references.

  • In case you want to search for GAC assembly references, search for the following string

    <Reference Include="System.Data" /> where System.Data is the assembly name

  • In case you want to search for a non GAC referenced assembly then search for the following string

    <Reference Include="WindowsFormsApplication2, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">




回答2:


You can use Project Hierarchy feature of ReSharper to see back and forward reference links. Right click your reference or project, choose Project Hierarchy.




回答3:


Devendra's answer already shows how you can get an answer to the question by doing a simple text search. I thought it might be worth showing that you can do the same thing using only PowerShell (in case you don't have an editor other than Visual Studio installed):

gci -Recurse -Filter '*.csproj' |
    where { $_ | sls '<Reference.*"System\.Data("|,)' } |
    select -ExpandProperty Name

Replace System\.Data with the full name of the assembly you're searching for.



来源:https://stackoverflow.com/questions/7416324/can-i-search-by-a-reference-name-solution-wise-to-see-in-which-projects-it-was

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!