如何在不同的解决方案中查找方法的所有引用。 [英] How to find all the references to a method in different solutions.

查看:112
本文介绍了如何在不同的解决方案中查找方法的所有引用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的项目中有不同的模块。每个模块都作为单独的解决方该项目有40多种解决方案。我正在一个解决方案中改变一种方法,例如。 Enctypt()方法。它是一种重载方法,它在不同的解决方案中被用于许多地方。我想找出引用此方法的所有位置。



有没有最好的方法/任何工具可以找到不同解决方案中所有方法的引用。



我尝试了什么:



我试图在所有解决方案中搜索Encrypt()方法,但它返回了数千个结果。因为在其他解决方案中也有同名的方法,母鸡它返回了很多结果。



我也尝试使用命名空间和类名进行搜索。



你宝贵的建议对我很有帮助。谢谢。

We have different modules in our project. Each module implemented as separate solution. There are 40+ solution in the project. I am making a change to one method in one solution eg. Enctypt() method. It is a overloaded method and it is being used in many places in different solutions. I want to find out all the places where this method is referenced.

Is there a best way / any tool available to find all the references to a method in different solutions.

What I have tried:

I tried to search for Encrypt() method in all the solutions but it returned thousands of results. because there are method with same name available in other solutions also, hens it is returning many results.

I tried to search with namespace and class name also.

your valuable suggestion will be very helpful to me. Thanks.

推荐答案

我认为你很困惑解决方案和项目 - Visual Studio加载一个解决方案,它可以包含多个项目:每个项目生成一个单独的汇编。

在解决方案中,您可以转到方法的定义,右键单击它的名称,然后选择查找所有引用以获取解决方案中使用的所有位置的完整列表。



但是,如果这是多个解决方案,那么AFAIK没有内置方法来定位单个方法的所有解决方案中的所有引用 - 如果只是因为项目与use对程序集(而不是项目)的引用没有任何指向程序集源的反向链接。
I think you are confusing "Solution" and "Project" - Visual Studio loads a single Solution, which can consists of multiple Projects: each Project generates a separate Assembly.
Within a Solution, you can go to the definition of a method, right click it's name, and select "Find All References" to get a complete list of everywhere it is used within the Solution.

If however, this is multiple Solutions, then there is AFAIK no built in method to locate all references in all Solutions of a single method - if only because Projects with use References to an Assembly (rather than a Project) do not have any back-links to the Assembly source.


你好naveen_g



如果你组织这样的解决方案你怎么把事情放在一起,我想知道?

我做什么:只在解决方案中使用项目参考,没有汇编 - 参考你自己的项目ts。

然后我将项目分组到我需要的解决方案中(让项目参与不同的解决方案完全有效)。

然后分层/分组你的解决方案 - 用于引用的一种分期(例如我使用共享,服务,客户端,数据,硬件,网关),以便创建尽可能少的项目重叠。

- >像你这样的问题应该很少......



然后,如果你有一个构建系统并使用CI,你会发现你已经打破了验证 - 构建其中一个分阶段(然后是汇编引用的)解决方案(当然,所有解决方案都应该由你的构建定义构建)。



但我必须承认这是一个漫长的过程和痛苦的方式组织这样的一切,并找到一个很好的工作流程,每个人都可以跟上...



所以也许一个更简单的解决方案可能是(取决于多少项目你真的有)为你的所有项目制作一个大的'虚拟'解决方案(这个只适用于你现在的情况,不要忘记在那里添加新项目,如果你创建新的解决方案或添加项目到现有的稍后。



亲切的问候



Johannes
Hi naveen_g

How you ever keep things together if you organize your solutions like this, I wonder?
What I do: Only work with project references inside solutions, no assembly-references to your own projects.
Then I group the projects together in the solutions I need them (it's perfectly valid to have a project take part in different solutions).
Then layer/group your solutions - Kind of "staging" for references (e.g. I use Shared, Service, Client, Data, Hardware, Gateway) so that the least possible project-overlap is created.
-> And problems like yours should be very seldom...

Then if you have a build-system in place and use CI you will find out on validation-build you broke one of the staged (then assembly-referenced) solutions (all solution concerned should be build by your builddefinition of course).

But I have to confess it was a long and painfull way to organize everything like that and find a nice workflow that everyone can keep up with...

So maybe a simpler solution could be (depends how many projects you really have) make one big 'dummy' solution for all your projects (this one will be just for cases like you have now, just don't forget to add new projects there also, if you create new solutions or add projects to existing ones later.

Kind regards

Johannes


加载所有项目都集成到一个解决方案中,并通过项目参考让它们相互引用尽管不太可能,下载一个名为IL Spy的工具,将所有程序集加载到其中并使用其分析功能向您展示哪些方法称为什么。
Load all projects into one solution and have them reference each other by project reference. If that's not possible\too much effort, download a tool called IL Spy, load all your assemblies into it and use its "Analyze" feature to show you what methods call what.


这篇关于如何在不同的解决方案中查找方法的所有引用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆