所以我们有一个应用程序启动器,它可以(应该)运行在 clickOnce 中创建的新应用程序和使用远程类型逻辑的旧应用程序
尝试运行应用程序时,我收到以下消息
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.
谷歌搜索我发现这段代码说更新应用程序配置
这修复了旧的应用程序,但现在破坏了新的应用程序
于是我发现 Setting useLegacyV2RuntimeActivationPolicy At Runtime
这“有效”是因为如果我先加载一个新应用程序,没问题,然后我加载一个旧应用程序就可以了,但是如果我去加载一个新应用程序,它就会停止工作。
因此,当我即将运行新应用程序时,要么我需要知道如何取消绑定 BindAsLegacyV2Runtime。或者我需要另一种方法?
谢谢