System.TypeLoadException:方法'get_xxx'没有实现 [英] System.TypeLoadException: Method 'get_xxx' does not have an implementation

查看:922
本文介绍了System.TypeLoadException:方法'get_xxx'没有实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题有很多问题浮出水面,我已经完成了工作,没有任何快乐。

There are a lot of questions floating around with this problem and i've worked through them ll with no joy.

我收到此错误:


方法'get_UserImageCDNUrl'类型'App.Web.WebConfig'来自程序集
'App.Web,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'
没有实现。

Method 'get_UserImageCDNUrl' in type 'App.Web.WebConfig' from assembly 'App.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

这真的很奇怪,因为我试图运行Api.Web没有引用App.Web,它们唯一的共同点是对其他项目的引用(Models.Domain和Models.DTO)。

Which is really strange because I am trying to run Api.Web which has no reference to App.Web, the only thing they have in common are references to other projects (Models.Domain and Models.DTO).

I在程序集Models.Domain中有一个界面:

I have an interface:

IResourceCompiler

我有一个抽象类,它在同一个程序集(Models.Domain)中实现这个接口,名为 WebConfigBase

I have an abstract class which implements this interface in the same assembly (Models.Domain) called WebConfigBase

在App.Web中Api.Web项目每个都有一个名为 WebConfig的类继承自 WebConfigBase ,因此App和Api中的 WebConfig 类都是 IResourceCompiler 的实现。

In the "App.Web" and "Api.Web" projects they each have a class called WebConfig which inherit from WebConfigBase, therefore both WebConfig classes in App and Api are implementations of IResourceCompiler.

我试图添加一个属性

string UserImageCDNUrl {get;}

IResourceCompiler 并将该属性添加到 WebConfigBase

public string UserImageCDNUrl 
{
    get { return ""; } 
}

因此,Api和Web项目都可以通过他们自己访问该属性 WebConfig 类,我得到上面的例外。

so the property would be accessible to both Api and Web projects through their own WebConfig classes, and i get the exception above.

我已经花了好几个小时试着看看为什么会发生这种情况并没有快乐。

I have looked for hours to try and see why this happens with no joy.

我已经清除了我的Obj文件夹,清理,重建,检查了GAC中的任何实例(没有任何实例),我仍然坚持这一点。

I've cleared my Obj folders, cleaned, rebuilt, checked for any instances in GAC (there aren't any) and i'm still stuck on this.

一切正常,直到我尝试向接口(和基类)添加新属性

Everything works fine until i try to add a new property to the interface (and base class)

推荐答案

好的,如此奇怪地在Api.Web中添加对App.Web的引用并再次删除它已经解决了这个问题。

OK, so bizarrely adding a reference to App.Web in Api.Web and removing it again has solved the issue.

我不知道为什么但是确实如此。

I have no idea why, but it did.

我将App.Web的版本更改为1.0.0.1,错误仍然显示为1.0.0.0,这促使我这样做。

I changed the version of App.Web to 1.0.0.1 and the error was still showing 1.0.0.0, which is what prompted me to do it.

我希望有更合理的解释,但没有。这样一个令人愤怒的问题我很高兴能用它来完成。

I wish there was a more reasonable explanation but there isn't. Such an infuriating issue i'm just glad to be done with it.

祝其他任何体验过此事的人好运,我的想法是和你在一起

Best of luck to anyone else who experiences this, my thought's are with you

这篇关于System.TypeLoadException:方法'get_xxx'没有实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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