C# Issues and Solutions -- Method get_XXX from assembly YYYY does not have an implementation

来源:互联网 发布:mac专柜地址 编辑:程序博客网 时间:2024/05/17 09:07

This can occur if you have an interface in one assembly and its implementation in another, and the implementation assembly was built against a different version of the interface.

If you want to try reproducing this, try the following:
   1. Create a class library project: InterfaceDef, add just one class, and build:
      
   2. Create a second class library project: Implementation (with separate solution), copy InterfaceDef.dll into project directory and add as file reference, add just one class, and build:


   3. Create a third, console project: ClientCode, copy the two dlls into the project directory, add file references, and add the following code into the Main method:


   4. Run the code once, the console says "hello world"
   5. Uncomment the code in the two dll projects and rebuild - copy the two dlls back into the ClientCode project, rebuild and try running again. TypeLoadException occurs when trying to instantiate the ImplementingClass.

http://stackoverflow.com/questions/948785/typeloadexception-says-no-implementation-but-it-is-implemented

原创粉丝点击