这是以下方面的后续措施:参考替代在Visual Studio 2010中引用程序集?
This is somewhat of a follow up to: Reference alternate to reference assembly in Visual Studio 2010?
我指的是核心框架DLL的替代版本.Visual Studio(和本地调试器结构)在引用此文件时没有问题.此外,该文件被标记为 Copy Local .但是,当我部署到云中时,会得到:
I am referencing an alternative version of a core framework DLL. Visual Studio (and the local debugger fabric) has no problem referencing this file. Additionally, the file is marked Copy Local. However, when I deploy to the cloud, I get:
无法加载文件或程序集'(程序集强名称)'或其依赖项之一.找到的程序集的清单定义与程序集引用不匹配.
Could not load file or assembly '(assembly strong name)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
使用远程桌面,我确定正确的文件确实在 E:\ approot 文件夹中,以及其他依赖项.我假设结构正在GAC中查找,而不是使用我的文件.
Using remote desktop, I determined that the correct file is indeed in the E:\approot folder along with my other dependencies. I am assuming that the fabric is looking in the GAC instead of using my files.
有没有一种方法可以强制它首先使用我的DLL?
Is there a way to force it to use my DLL first?
注意:无论如何,替换.NET CLR DLL的整个概念都是一个巨大的漏洞,因此欢迎黑客入侵.当.NET 4.5支持我需要的功能时,所有这些都将被剥离.
Note: The entire concept of replacing a .NET CLR DLL is a huge hack anyway, so hacks are welcome. When .NET 4.5 comes out supporting the feature I need, this will all be stripped out.
更多信息:看来我的Web角色工作正常,但是我的辅助角色在尝试构建Autofac容器时死于该错误.即使我在构建程序集之前显式加载了程序集,也会发生这种情况.
Further info: It appears my web role works fine, but my worker role dies with that error when it attempts to build my Autofac container. This happens even if I explicitly load the assembly before building it, which also works fine.
推荐答案您可以运行融合日志以查看其从何处加载.如果正在运行其他文件并首先加载该文件,则可能需要为该过程创建一个.config文件.您也许可以执行一些特殊的操作,例如创建一个新的appdomain并在其中加载程序集,例如对动态程序集所做的操作:
You could run a fusion log to see where it is loading from. You may need to create a .config file for the process if something else is running and loading that file first. You may be able to do something exotic also like create a new appdomain and load your assembly there, something like what this does for dynamic assemblies:
blogs.msdn/b/tom/archive/2007/12/05/dynamic-assemblies-and-what-to-do-about-them.aspx
更多推荐
Azure引用了错误的DLL
发布评论