Quantcast
Viewing all articles
Browse latest Browse all 2367

在單元測試專案使用 dynamic 出現 CSharpArgumentInfo.Create 錯誤

在自動測試專案加入使用 dynamic 型別的測試方法後,Visual Studio 2017 傳回編譯錯誤:

Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'

Image may be NSFW.
Clik here to view.

在 Microsoft Connect 查到相似錯誤回報,案例集中在微軟單位測試及 NUnit 測試專案(NUnit 可透過更新版本解決),推測為單元測試專案預設未參照 Microsoft.CSharp.dll,而它是使用 dynamic 的必要參照。

問題在為單元測試專案手動加入參照後排除(如下圖),特此筆記。

Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 2367

Trending Articles