I\'m trying to migration our website from .Net 3.5 to 4 and I\'m encountering a very weird issue.
Code that works just fine in 3.5 does not anymore once I target .Net4,
Similar to some of the other posts, in my case I was completely missing a reference to an assembly. It wasn't directly accessed from the project I was working with, but was accessed in another, linked project that I was referencing.
For me this occurred due to a missing or out of date System.ValueTuple
when using multiple return values in c# 7.
The error message is a bit misleading.
Similar to others here, if the referenced assembly is targeted to 'Any CPU', while the current assembly is targeted to 'Any CPU' will cause the problem (at least on a 64 bit machine).
It might help to call property field differently. Because TimeZoneInfo is also a class in System namespace.
Similiar to Jonathan Perry's answer, in my case I had a reference to an old assembly, not the compiled one. I removed the reference and added it again pointing to the correct dll.
It's probably an assembly inconsistency issue. I had this problem when I wanted to use an assembly that created a circular reference with another project. Once I fixed this circular reference issue, the error didn't appear anymore.