2013-05-09 127 views
0

所以我們可以(應該)運行的ClickOnce創建了使用邏輯的遠程型新的應用程序和較舊的應用程序的應用程序啓動解除綁定BindAsLegacyV2Runtime

當試圖運行我收到以下消息應用程序

Cannot load assembly. Error details: System.IO.FileLoadException: Could not load 
file or assembly 'program' or one of its dependencies. Operation is not 
supported. (Exception from HRESULT: 0x80131515) File name:'program' 
---> System.NotSupportedException: An attempt was made to load an assembly from 
a network location which would have caused the assembly to be sandboxed in 
previous versions of the .NET Framework. This release of the .NET Framework does 
not enable CAS policy by default, so this load may be dangerous. If this load is 
not intended to sandbox the assembly, please enable the loadFromRemoteSources 
switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information. 

谷歌搜索,我發現這段代碼,表示更新應用程序配置

Loading blocked and network-hosted assemblies with .NET 4

那修復舊的應用程序,但現在打破了新的應用程序

所以後來我發現 Setting useLegacyV2RuntimeActivationPolicy At Runtime

而在這個「作品」如果我打開一個新的應用程序第一,沒有問題的話,我裝載舊的應用程序,它是確定,但如果我去加載一個新的應用程序停止工作。

所以要麼我需要知道如何解除綁定BindAsLegacyV2Runtime當我即將運行新的應用程序。或者我需要一個完整的方法?

感謝

回答

0

添加

<runtime> 
    <loadFromRemoteSources enabled="true"/> 
</runtime> 

解決了該問題對兩種類型的應用程序