影复制和混合的C#和C ++的DLL从任意文件夹中加载 [英] Shadow Copying, and mixed C# and C++ DLLs loading from arbitrary folders
问题描述
我有一个使用特殊的插件文件夹来加载额外的DLL(用作一种资产转换过程节点)一VS 2005的C#项目。
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).
我有一个该文件夹中的C#和C ++的DLL的混合物。
I have a mixture of C# and C++ DLLs in this folder.
我的问题是,当启用卷影复制,在C ++的DLL拒绝使用Assembly.LoadFrom加载。我试图创建一个自定义的应用程序域,并使用负载,但这也失败了。
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作为字节[]的数据和使用Load上 - 再次,只有C#的DLL会以这种方式工作,并显示错误。
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时,但后来根本没有建立,由于数以千计的错误,在微软的源代码...(显然)
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)
使用禁用阴影复制,LoadFrom对所有的DLL工作正常。该应用程序本身就是玛雅的插件,而这个使用与Maya 8.5的工作,但失败2009分之2008(如果启用卷影复制)。
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).
我们真的很希望使用影子复制,因为它可以防止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).
任何想法,我怎么能说服暗影复制到一个自定义文件夹和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?
推荐答案
听起来像一个信任问题。尝试获得融合日志(请参阅这篇博客文章) 。你的C ++ DLL是无法证实的,因为他们没有与 / CLR编译:安全
,所以它们只能加载为完全信任。据推测,当影子复制,下载缓存位置没有完全信任。
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屋!