InvalidCastException for Object of the same type - Custom Control Load

后端 未结 5 2106
予麋鹿
予麋鹿 2020-12-28 15:35

I have a very wired error, one of my custom controls seems that is create two compiled files, and when I try to load it dynamically with LoadControl() is just f

5条回答
  •  无人及你
    2020-12-28 15:45

    I've recently encountered similar problem when i was compiling a modified version of asp.net MVC 4 and importing the new DLL into the project.

    Somehow i was referencing the old versions of the DLLs in the web.config (including the web.config in the views folder)

    The error in my case was thrown because the two DLLs were different versions. 4.0.0 and 4.1.0. Maybe you should look into that. Maybe specify a version of the compiled files (i'm guessing DLLs)

    I hope this helps you fix the problem.

    other tips: I'm guessing you have some sort of version control system? if yes , revert all the changes back before this started and look carefully at the code and which models/controls change and how. if you are not using VCS... there isn't much you can do to revert the changes. And you should start using a VCS.

提交回复
热议问题