解决TypeLoadExceptionTypeLoadException

由网友(寒江映月)分享简介:我只是想和大家分享一些我的经验教训。大约有TypeLoadExceptions这里很多帖子,但没有人似乎有我需要的答案。I just wanted to share something I learned. There are many posts about TypeLoadExceptions here, bu...

我只是想和大家分享一些我的经验教训。大约有TypeLoadExceptions这里很多帖子,但没有人似乎有我需要的答案。

I just wanted to share something I learned. There are many posts about TypeLoadExceptions here, but none of them seemed to have the answer I needed.

本页面有一些特别好的信息,但似乎并没有专门解决我所看到的,我怎么解决它(可能是错误的):

This page has some particularly good information, but didn't seem to specifically address what I was seeing and how I resolved it (could be wrong):

TypeLoadException说没有实现,但它的实现

解决方案对我来说很简单:删除任何文件,Visual Studio 2010的高速缓存和用来生成汇编文件

The SOLUTION for me was simple: Delete any files Visual Studio 2010 caches and uses to generate assembly files.

问题的背景:的

下面是一些更多的细节。我看到像TypeLoadException:

Here are some more details. I was seeing a TypeLoadException like:

未处理的异常:System.TypeLoadException:法[方法名]   从程序集[组件名称]类型[类型名称]版本= XXXX,   文化=中性公钥=空没有实现。

Unhandled Exception: System.TypeLoadException: Method [method name] in type [type name] from assembly [assembly name], Version=x.x.x.x, Culture=neutral, PublicKeyToken=null does not have an implementation.

我也有一个实现......我想,直到我看着与ILDASM大会。我发现我越来越老版本写入到了过时的接口,我的输出中的文件夹的DLL。我的输出文件夹并不是默认设置,但项目文件夹之外的相对路径(也许VS无法处理这种完全??)。做清洁后/重建的项目,该项目的目标文件文件夹在我的项目文件夹的是对DLL中正确时间戳所有子文件夹的唯一文件夹。在bin文件夹出于某种原因,仍然有一个旧版本。而我想这是什么得到复制到输出文件夹。

I did have an implementation...I thought, until I looked at the assembly with ILDASM. I discovered I was getting old versions of DLLs written to my ouput folder that had outdated interfaces. My output folder was not the default setting, but a relative path outside of the project folder (maybe VS can't handle this completely??). After doing clean/rebuild on the project, the project's "obj" folder was the only folder in all child folders of my project folder that had the correct datestamp on the DLL. The "bin" folder for some reason still had an old version. And I suppose that was what was getting copied to the output folder.

在此我曾尝试:

清洁/重建 在重新启动的Visual Studio(2010年) 重新启动 删除我的集DLL中的输出文件夹(BIN 86 调试)

......没有成功。

...with no success.

我不知道为什么VS是不是在目标文件复制正确装配到输出文件夹...这所引用的过时组件的该项目是正确的

I'm not sure why VS wasn't copying the correct assembly in "obj" to the output folder... The project that referenced the outdated assembly was correct.

推荐答案

您使用某种类型的源代码控制的,做入住和退房的东西?如果是,请确保OBJ和bin文件夹中,以源头控制不检查。如果他们再从源头上控制删除它们,检查一切,然后重新建立自己的解决方案。

Are you using some kind of source control and doing check in and check out stuff? If yes, make sure that the obj and bin folders are not checked in to the source control. If they are then delete them from the source control, check everything in, and then re-build your solution.

阅读全文

相关推荐

最新文章