出現 Error 1: Interop Type Cannot Be Embedded

更新 Dec 22, 2022

產品資訊

軟體

  • TestStand 2010 SP1
  • TestStand 1.0
  • TestStand 3.1
  • TestStand 4.0
  • TestStand 4.1.1

問題敘述

在針對 .NET 4.0 Framework 的Visual Studio 2010 新專案中使用某些 TestStand 型態時,我看到類似以下的錯誤:

Error 1 Interop type 'NationalInstruments.TestStand.Interop.API.GetSeqFileOptions' cannot be embedded. Use the applicable interface instead.

如何防止此錯誤發生?

解決方案

發生此錯誤的原因是新專案中引用的  TestStand API Interop assembly 的 Embed Interop Types 屬性的預設值為true。若要解決此錯誤,請按照以下步驟將“ Embed Interop Types 屬性的值更改為“ False”
  1. 在專案的 Solution Explorer 中,選擇 references 項目中的 TestStand Interop Assembly 。

  2. 在 Property Browser 中找到“ Embed Interop Types”屬性,並將值更改為False