C# Error “Is not supported by the language” after migration to .Net4

前端 未结 8 1588
旧时难觅i
旧时难觅i 2021-02-05 03:58

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,

相关标签:
8条回答
  • 2021-02-05 04:11

    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.

    0 讨论(0)
  • 2021-02-05 04:14

    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.

    0 讨论(0)
  • 2021-02-05 04:15

    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).

    0 讨论(0)
  • 2021-02-05 04:20

    It might help to call property field differently. Because TimeZoneInfo is also a class in System namespace.

    0 讨论(0)
  • 2021-02-05 04:22

    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.

    0 讨论(0)
  • 2021-02-05 04:26

    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.

    0 讨论(0)
提交回复
热议问题