旧的DLL文件不断被使用 [英] Old DLL file keeps being used

查看:139
本文介绍了旧的DLL文件不断被使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个看似随机的问题,我的项目将使用不再存在的旧版本的DLL文件运行。有时会使用DLL文件的真正版本,其他时候会使用古代版本的DLL文件。谁知道Visual Studio从哪里获取这个DLL文件 - 这是几个月过期!



我知道它正在使用旧的DLL文件,因为当应用程序运行时开始变得奇怪的TypeLoadExceptions,抱怨方法不存在或没有实现。



以下操作有时会有所帮助,有时不能:




  • 重新启动Visual Studio

  • 重新启动计算机

  • 清理并重建解决方案

  • 删除\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET文件中的所有内容

  • 搜索在\Documents和Settings\username\Local Settings\Temp



中的DLL文件实例和删除实例有时我执行所有上述步骤,它仍然使用DLL文件的旧版本。它在哪里隐藏?



我们的 TeamCity 使用 MSBuild 的服务器。当TeamCity尝试运行单元测试时,它使用一个旧的DLL文件。



现在,我知道我可以在 web.config中使用程序集重定向文件,但是DLL文件的版本号没有改变(我不用担心更新它,所以它只保留在版本1)。我不想要开始版本化DLL文件来解决这个问题。我只想知道我需要清除哪些特定缓存,以便我可以继续开发。

解决方案

它隐藏它在 GAC 中。它可能无限期地驻留。使用更新版本可能确实可以解决问题,但Visual Studio中存在与选择正确版本的DLL文件有关的突出错误。 (如果 DLL Hell 还不够糟糕,Visual Studio团队会变得更糟!)



在GAC中找到它是棘手的,我不能建议你如何做,但一旦旧版本从那里删除,它将不会再被发现。有时,即使您将编译器指向较新版本(按日期),它将使用较旧版本,因为它具有相同的版本级别(按版本)。这是它的错误。


I have a seemingly random problem where my project will run using an old version of a DLL file that no longer exists. Sometimes the real version of the DLL file will be used, other times an ancient version of the DLL file will be used. Who knows where Visual Studio is getting this DLL file from - it's months out of date!

I know that it is using the old DLL file, because when the application runs I start getting weird 'TypeLoadExceptions', complaining that methods don't exist or don't have implementations.

The following actions will sometimes help, sometimes not:

  • Restarting Visual Studio
  • Restarting the computer
  • Cleaning and rebuilding the solution
  • Deleting everything in \WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
  • Searching for and deleting instances of the DLL file in \Documents and Settings\username\Local Settings\Temp

Sometimes I perform all of the above steps, and it still uses an old copy of the DLL file. Where is it hiding it?!

The same issue exists on our TeamCity server which is using MSBuild. When TeamCity tries to run unit tests it uses an old DLL file.

Now, I know that I can use assembly redirection in the web.config file, but the version number of the DLL file hasn't changed (I don't bother to update it, so it just stays at version 1). I don't want to have to start versioning the DLL files just to solve this problem. I would just like to know which particular caches I need to clear so that I can get on with developing.

解决方案

It hides it in the GAC. There it may reside indefinitely. Using a more recent version may indeed solve the problem, but there is an outstanding bug in Visual Studio that has to do with choosing the correct version of DLL files. (If DLL Hell wasn't bad enough, the Visual Studio team is making it worse!)

Finding it in the GAC is tricky, and I cannot advise you on how to do that, but once the old version is deleted from there, it will not be found again. Sometimes, even though you are pointing the compiler at a newer version (by date), it will use the older version, because it has the same version level (by version). That is its bug.

这篇关于旧的DLL文件不断被使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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