I get this error about casting from type A to type B because the dll is in different location. One is where it’s supposed to be, and the other is in C:/ProgramFiles/Microsoft… in a load neither context.
It is very annoying problem.
My code crashes on this line:
serializer.Serialize(sw, some);
Let me tell you something about the project. I first build a .dll which I put in specific folder and then in another solution I load it and try to serialize it.
I always load dll files with the Assembly.LoadFrom method. I tried changing every LoadFrom with LoadFile but it says the same exception.
Why is this happening? How to solve it?
I actually couldn’t solve this, so I used XmlWriter instead.