在运行时从.NET中的外部进程获取表单源文件
我目前正在处理一个非常大的解决方案(120 多个项目)。很多时候,我们需要在一个由数百个表单组成的大型桌面应用程序中找到特定的表单。
例如,我们可能需要编辑某个表单上的某些控件。
我们不知道表单名称,但我们知道在运行应用程序时如何导航到表单。
为了识别表单,我们目前尝试在表单上查找一些唯一的文本,然后在所有源文件中搜索该字符串。这不太酷。
相反,我想制作一个小工具,可以识别表单的源文件,或者至少识别表单对象的 name 属性。
我们无法向解决方案本身添加代码,因此我们必须创建一个外部 exe。
我不确定这是否可能。我认为通过反思也许有可能,但我不是这方面的专家。
如果有人有关于如何解决问题的想法,那就太好了。
谢谢。
I am currently working in a very large solution (120+ projects). Very often, we need to find a particular form in a large desktop application, consisting of hundreds of forms.
For example, we might have a requirement to edit some controls on a certain form.
We don't know the form name, but we know how to navigate to the form when running the application.
In order to identify a form, we currently try to find some unique text on the form, and then search all the source files for this string. That's not very cool.
Instead, I'd like to make a little tool that can identify the source file for a form, or at least the name property of the form object.
We can't add code to the solution itself, so we will have to make an external exe.
I am not sure if this is even possible. I am thinking it might be possible through reflection, but I'm no expert on the matter.
If anyone have ideas as to how to solve the problem, that would be great.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我为此使用了托管间谍。它在基于 .NET 的客户端应用程序中显示控件的树视图。当您选择一个控件时,PropertyGrid 将显示该控件的属性。
I used Managed Spy for this. It displays a treeview of controls in your .NET-based client application.When you select a control, the PropertyGrid shows properties on that control.
Morten,
我是一个讨厌的黑客...我有同样的问题(或多或少),所以我在主窗体上设置了一个隐藏的双击点(仅在 #if DEBUG 中)关闭了数据库连接,所以下次访问就会崩溃。然后在 VS 中,我只需设置“中断任何异常”,双击那里,执行“提交”,TADA,它向我展示了我在这个令人困惑的世界中到底在哪里。堆栈跟踪也可以。
干杯。基思.
Morten,
I'm a nasty hacker... I had the same problem (more or less), so I setup a hidden double-click-point on the main form which (in #if DEBUG only) closed the database connection, so the next access would crash. Then in VS I just set "break on any exception" double-click-just-there, do a "submit", and TADA, it shows me where-the-hell-in-this-bluddy-confusing-world am I. A stack trace would do just as well.
Cheers. Keith.
一些自动化测试工具将为您提供有关正在运行的表单的大量信息。
基本上控件本身的所有属性。
在我们公司,我们使用 CodeComplete。
不过这是一个必须购买的工具,您可以免费搜索一些类似的工具。
Some Automated test tools will give you a lot of info about a running form.
Basically all the properties of the control itself.
In our company we use CodeComplete.
However that is a tool that must be bought, you may search for some smilar free.