阴影复制,以及从任意文件夹加载混合C#和C ++ DLL [英] Shadow Copying, and mixed C# and C++ DLLs loading from arbitrary folders

查看:129
本文介绍了阴影复制,以及从任意文件夹加载混合C#和C ++ DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VS 2005 C#项目,使用一个特殊的插件文件夹来加载额外的DLL(用作资产转换过程中的节点)。

I have a VS 2005 C# project that uses a special Plugin folder to load extra DLLs (for use as nodes in an asset conversion process).

我遇到的问题是当Shadow Copying启用时,C ++ DLL拒绝使用Assembly.LoadFrom加载。我尝试创建一个自定义应用程序域,并使用Load,但这也失败。

The issue I have is that when Shadow Copying is enabled, the C++ DLLs refuse to load using Assembly.LoadFrom. I have attempted to create a custom app domain, and used Load, but this also failed.

最后,我尝试读取DLL作为byte []数据和使用Load - 再次,只有C#DLL将以这种方式工作,并带有错误附加信息:不可验证的代码失败的策略检查(来自HRESULT:0x80131402)。

Finally, I tried reading the DLL in as byte[] data and using Load on that - again, only the C# DLLs would work this way, with an error "Additional information: Unverifiable code failed policy check. (Exception from HRESULT: 0x80131402)".

在网上的一篇文章促使我尝试使用/ clr:安全时,构建该特定的DLL,但然后它只是无法构建由于Microsoft代码中的成千上万的错误...(显然)

An article on the net prompted me to attempt to use /clr:safe when building that particular DLL, but then it simply failed to build due to thousands of errors in Microsoft code... (apparently)

禁用Shadow Copying后,LoadFrom对所有DLL都可以正常工作。该应用程序本身是一个Maya的插件,并且这用于与Maya 8.5一起工作,但在2008/2009年失败(如果启用了Shadow Copying)。

With Shadow Copying disabled, LoadFrom works fine for all DLLs. The app is itself a plugin for Maya, and this used to work with Maya 8.5 but fails with 2008 / 2009 (if Shadow Copying is enabled).

使用Shadow Copying,因为它在应用程序运行时阻止DLL文件锁定(Plugins文件夹存储在Perforce可以在应用程序运行时更新的位置)。

We really would prefer to use Shadow Copying, because it prevents DLL file locks when the app is running (the Plugins folder is stored in a location that Perforce can update while the app is running).

任何想法,如何我可以说服Shadow Copying使用自定义文件夹和混合的C#/ C ++ DLL没有这些问题?

Any ideas as to how I can persuade Shadow Copying to work with a custom folder AND a mix of C# / C++ DLLs without these problems?

推荐答案

听起来像一个信任问题。尝试获取Fusion日志(请参阅此博文) 。您的C ++ DLL是不可验证的,因为它们不是使用 / clr:safe 编译的,因此它们只能作为完全信任加载。大概当阴影复制时,下载缓存位置没有完全信任。

Sounds like a trust issue. Try getting a Fusion log (see this blog post). Your C++ DLLs are unverifiable since they weren't compiled with /clr:safe, so they can only be loaded as full trust. Presumably when shadow copying, the download cache location doesn't have full trust.

运行 caspol -s 如果这是仅限开发的问题,您就可以开始运行。

Running caspol -s may get you up and running if this is a development-only issue.

这篇关于阴影复制,以及从任意文件夹加载混合C#和C ++ DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆