2010-11-30 114 views
2

我加入一個庫項目,並且我收到以下錯誤:Visual Studio中添加DLL作爲參考錯誤

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

我不太確定我有什麼爲了調整這種來回跑步。任何人都知道變化應該是什麼?

感謝,

PM

+0

是 「在4.0編譯庫」 選項嗎? – 2010-11-30 07:00:57

+0

不知道如果我遵循,你的意思是在4.0重建庫?不,我不能。 – user472875 2010-11-30 07:02:45

回答

2

正如馬克所說,理想情況下,您將在.NET 4,中重建,使您的項目的目標.NET 3.5或更低。爲v2 CLR構建的混合模式程序集使用「傳統」運行時激活技術,這些技術與v4 CLR在同一進程中運行多個CLR的能力不兼容。

或者,您也可以將此信息添加到您的app.config:

<configuration> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0"/> 
    </startup> 
</configuration> 

this questionthis documentationblog post瞭解詳情。

1

未經檢驗的,但也許(從MSDN

<?xml version="1.0"?> 
<configuration> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    </startup> 
</configuration>