2014-03-19 85 views
2

我有一個「common」項目。我們稱之爲:MyProject.Common 該項目有一個命名空間Serials.Licensing,其中包含一個類許可證,其中包含靜態變量C#在另一個引用的不同合併程序集中的相同類型和命名空間

因此,這將是共同項目的結構:

MyProject.Common (dll) 
| -> Serials.Licensing (namespace) 
    | -> License (class with static variables) 

使用IlMerge,我合併該組件在兩個不同的程序集(A.DLL,B.DLL)。這將是與IlMerge 2個創建的程序集的結果:

assemblyA (dll) 
    | -> Serials.Licensing (namespace) 
     | -> License (class with static variables) 

    | class "classA" using the License class of this dll 

而且

assemblyB (dll) 
    | -> Serials.Licensing (namespace) 
     | -> License (class with static variables) 

    | class "classB" using the License class of this dll 

正如你可以看到,無論是裝配有使用許可類合併類(ClassA的,CLASSB)他們自己的程序集

如果在一個新的項目(projectC)中,我同時引用dll A和dll B.會出現類許可證中靜態變量的問題(如衝突)嗎?

我很困惑,因爲我不知道,如果這兩個DLL中和DLL B就擁有自己的「上下文」或是否會有問題,因爲空間和類型是相同的許可類的靜態變量。

+2

你試過了嗎? –

+0

許可證的範圍是什麼?如果你使它內部有幫助嗎? –

回答

0

如果您嘗試訪問類型中的某些內容,您將收到一個編譯錯誤,告訴您類型License存在於A.dll和B.dll中。所以這不適合你。 如果你永遠不會訪問該類型,那麼該項目應該編譯得很好。

相關問題