解决方法及原因:System.Core冲突,直接将3.5版本的System.Core删掉,只保留4.0的即可
I solved it in the following way:
First i noticed using gacutil (Global Assembly Cache Utility) that it contained two references to System.Core, one to version 4.0 and one to version 3.5. Apparently inside the razor views, even if in the project i had the correct reference to version 4.0, it was still using version 3.5 and that's why i was getting the error about the dynamic types. To check if that's your case open as administrator Visual Studio Command Prompt and execute:
gacutil -l System.Core
To remove the reference to the old version of System.Core i did the following steps:
- cd %systemroot%\assembly\
From here you may have more that one "gac" directory, so you will have to search within each to find your component. For me, it was within the "gac_MSIL" directory.
- cd gac_msil