WinForms 中令人困惑的 DLL 使用

发布于 2024-11-02 13:10:14 字数 370 浏览 4 评论 0原文

我有一个 WinForms 项目和解决方案,一些类库项目也添加到同一解决方案中。

WinForms 项目使用类库中的代码。我已经使用这个应用程序大约一年了,它一直运行良好。

然而,今天,我向类库添加了一些功能,但这些更改不会出现在正在运行的应用程序中。我还尝试向其中一个类添加一个新的公共方法,但该方法没有显示在应用程序的 Intellisense 中。

这应该很容易解决,但是,由于 WinForms 在幕后自动复制 DLL 的方式,我不知道问题出在哪里。我所看到的一切对我来说似乎都是正确的。该代码继续工作,就像使用旧版本的 DLL 一样。但我的 WinForms 应用程序的 Bin 目录中的 DLL 具有今天的日期。

谁能建议我应该在哪里寻找解决方案?

I have a WinForms project and solution, with some class library projects also added to the same solution.

The WinForms project uses code in the class libraries. I've been using this app for about a year and it has always worked well.

However, today, I added some functionality to the class library but those changes do not appear in the running application. I also tried adding a new public method to one of the classes, but that method does not show up in Intellisense for the application.

This should be really simple to resolve but, with the way WinForms is automatically copying DLLs behind the scenes, I have no idea where the problem is. Everything I look at seems right to me. The code continues to work as thought it's using an old version of the DLL. But the DLL in my WinForms app's Bin directory has today's date.

Can anyone make a recommendation on where I should be looking for a solution to this?

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

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

发布评论

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

评论(3

静水深流 2024-11-09 13:10:14

我会进入项目属性,删除引用,重新添加它以验证您的 dll 是否来自您认为的位置。清洁&重建项目

I would go into project properties, delete the reference, re-add it to verify your dll is coming from the location you believe it to be. Clean & rebuild project

薔薇婲 2024-11-09 13:10:14

根据 Michael 的回答,您可能会发现程序集引用实际上并不是项目引用,而不是特定路径,该路径不是您编译到的路径(例如 bin\Release)。

另外,这可能听起来微不足道,但在使用“构建”功能时,请仔细检查解决方案的配置属性是否确实正在构建项目!我关闭了项目的构建,只是为了忘记我这样做了,然后当他们的更改不在我的应用程序中时,我感到很困惑!

As per Michael's answer you might find that the assembly reference is not actually a project reference but rather to a specific path which isn't the path you compiled to (for example bin\Release).

Also, this might sound trivial, but double check that your solution's Configuration Properties are actually building the project when you use the Build function! I've turned off projects from building only to forget that I did so and then I got perplexed when their changes aren't in my app!

凶凌 2024-11-09 13:10:14

您是否已将任何类库放入 GAC 中?

如果 GAC 中存在具有相同 AssemblyVersion 的强名称程序集,则将使用该程序集而不是解决方案中的程序集。

Have you put any of the class libraries in the GAC?

If a strong-named Assembly with the same AssemblyVersion were in the GAC, this would be used instead of the one in your solution.

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