如何调试像 CodeCampServer 这样基于依赖注入的代码?

发布于 2024-08-18 16:59:18 字数 491 浏览 10 评论 0原文

我的项目结构类似于CodeCampServer结构等UI.dll,Core.dll和DependencyResolution.dll,它们都依赖于UI.dll和core.dll。

在 web.config 中,我使用 DependencyResolution.dll 中的 HttpModule 来实例化所有依赖项,因此我无法在 VS2008 中运行此应用程序,因为 UI.dll 没有对 DependencyResolution.dll 的引用(我可以不要引用它,因为正如我已经说过的,DependencyResolution.dll 已经引用了 UI.dll),因此我失去了以常规方式单步执行代码来调试该应用程序的机会。

我想也许我可以尝试使用附加到进程功能,并在本地主机 IIS(Windows 7 计算机上的版本 7)上调试应用程序,但不幸的是它没有按预期工作。当发生错误时,VS不会突出显示代码,我也无法介入它。

我的问题是调试此类应用程序的最佳方法是什么(CodeCampServer 就是一个很好的例子)。

My project structure is like CodeCampServer structure, etc. UI.dll, Core.dll and DependencyResolution.dll that have a dependecy of both of UI.dll and core.dll.

In the web.config I use a HttpModules from the DependencyResolution.dll, to instantiate all the dependencies, and therefore I can't run this application in VS2008 because the UI.dll don't have a reference to DependencyResolution.dll (I can't reference it because as I already said DependencyResolution.dll have already reference to UI.dll), so therefore I lost the opportunity to debug this application in a regular manner of step into the code.

I thought maybe I can try use the attach to process feature, and debug the application on the localhost IIS (version 7 on windows 7 machine) but unfortunately it's not worked as expected. when an error occur the VS don't highlight the code, and I can't step in to it.

My question is what the best way to debug this kind of applications (CodeCampServer is a good example).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぽ尐不点ル 2024-08-25 16:59:18

仅仅因为您没有对 .dll 的引用并不意味着您无法调试该应用程序。您应该能够正常调试应用程序,但如果它抱怨缺少 DependencyResolution.dll,您可以将其手动复制到 bin 文件夹,或者编写一个为您执行此操作的构建后脚本。

Just because you don't have a reference to the .dll doesn't mean that you can't debug the application. You should be able to debug the application as normal, but if it complains about the missing DependencyResolution.dll, you can copy it to the bin folder manually, or write a post-build script that does it for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文