共用方式為


編譯器警告 (層級 1) C4945

'symbol': 無法從 'assembly2' 匯入符號: 因為 'symbol' 已經從另一個元件 'assembly1' 匯入

符號是從參考的元件匯入,但該符號已經從另一個參考的元件匯入。 請勿參考其中一個元件,或取得其中一個元件中變更符號名稱。

下列範例會產生 C4945。

// C4945a.cs
// compile with: /target:library
// C# source code to create a dll
public class ClassA {
   public int i;
}

然後

// C4945b.cs
// compile with: /target:library
// C# source code to create a dll
public class ClassA {
   public int i;
}

然後

// C4945c.cpp
// compile with: /clr /LD /W1
#using "C4945a.dll"
#using "C4945b.dll"   // C4945