引用预构建的 .exe 的 C# 解决方案

发布于 2024-09-19 20:51:16 字数 491 浏览 3 评论 0原文

我有一个项目,它是我们应用程序的核心。我们构建了几个 DLL 和一个 EXE。

然后,我们有自定义项目,使用预构建的核心 DLL 和 EXE,并根据需要添加自定义/额外位。这些自定义始终是 DLL,始终使用核心 EXE。自定义解决方案引用核心 DLL/EXE。

我在调试加载自定义 DLL 时遇到了一些问题。由于 EXE 是预先构建的,因此我们使用其中一个项目作为启动项目,该项目指向 EXE 和其余 DLL 的位置。然而,它似乎并没有加载启动项目 DLL。

当 EXE 已经构建时,我应该如何设置我的自定义解决方案/项目?

(注意:如果您想知道,自定义 DLL 提供从元数据反射加载的组件)

更新:当前的方法是在自定义解决方案的“顶级”项目中创建一个构建后事件,该项目复制所有核心 DLL和 EXE 到 bin/Debug 目录中。然后将该顶级项目设置为启动项目,并指向 bin/Debug 中复制的 EXE。然后它会找到 DLL,因为它与 EXE(以及所有其他文件)位于同一目录中。

I have a project which is the core of our application. We build several DLLs and an EXE.

We then have custom projects which use pre-built core DLLs and EXE and add customisations/extra bits as required. These customisations are always DLLs, the core EXE is always used. The core DLLs/EXE are referenced by the custom solution.

I'm having a bit of a problem while debugging getting the custom DLLs to load. Because the EXE is pre-built we use one the projects as the startup project which points to the location of the EXE and the rest of the DLLs. However it then doesn't seem to the load the startup project DLLs.

How should I be setting my custom solution/projects up when the EXE is already built?

(NOTE: the custom DLLs provide components which are loaded reflectively from metadata if you're wondering)

UPDATE: Current approach is to have a post-build event in the "top-level" project of the custom solution which copies all the core DLLs and EXE into the bin/Debug directory. Then set that top level project as the startup project and point to the copied EXE in bin/Debug. It then finds the DLL because it is in the same directory as the EXE (along with all the others).

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

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

发布评论

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

评论(2

打小就很酷 2024-09-26 20:51:16

选择 DLL 作为启动项目并不能以任何方式保证它实际被加载。您使用的 EXE 必须使用 Assembly.Load/From() 来加载 DLL。此时调试器会介入并激活您设置的断点。

从“调试”+“窗口”+“模块”窗口很容易看出。如果您在该窗口中没有看到 DLL 加载,那么什么也不会发生。您需要找出该 EXE 的确切配置规则,以便它加载您想要调试的 DLL。

Selecting a DLL as the startup project does not in any way guarantee that it actually gets loaded. That EXE you are using has to use Assembly.Load/From() to get the DLL loaded. At that point does the debugger step in and activate the break-points you set.

Easy to tell from the Debug + Windows + Modules window. If you don't see your DLL loaded in that window then nothing is going to happen. You'll need to find out what the exact configuration rules are for that EXE so that it will load the DLL you want to debug.

请你别敷衍 2024-09-26 20:51:16

您可以运行 .exe,然后将 Visual Studio 调试器附加到该进程。确保 .dll 的 .pdb 位于执行目录中。

You can run the .exe, then attach Visual Studio Debugger to the process. Make sure the .pdb for your .dll is in the executing directory.

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