我正在嘗試在Microsoft Visual C#2010中編譯此代碼using System;using System.Globalization;class main{ static void Main() { dynamic d; d = "dyna"; Console.WriteLine(d); }}但是我遇到了這兩個錯誤錯誤1未定義或導入預定義的類型'Microsoft.CSharp.RuntimeBinder.Binder'錯誤2找不到編譯動態(tài)表達式所需的一種或多種類型。您是否缺少對Microsoft.CSharp.dll和System.Core.dll的引用?我讀了另一篇文章,但是我是C#的新手,我不明白真正的問題是什么。特別是這些所謂的.config文件在什么地方。
3 回答

holdtom
TA貢獻1805條經驗 獲得超10個贊
除了刪除和添加回引用不能解決該錯誤外,我遇到了同樣的問題,因此我將.Net版本從更改4.5為4.5.1。
為此,請轉到您的web.config文件并更改以下幾行
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
對此
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
并重建。
- 3 回答
- 0 關注
- 1011 瀏覽
添加回答
舉報
0/150
提交
取消