我在加载 DLL 及其引用时遇到问题。场景是这样的:
我有一个 C# 库项目(我们称之为“A”),它引用另一个 C# 库项目(我们称之为“B”)。这些项目的 Dll 都存储在 Azure Blob 存储中,但这实际上无关紧要。
作为我的项目的一部分,我正在使用 XslCompiledTransform.Transform
。使用 Assembly.Load
加载 dll A 后,我再次使用 Assembly.Load
加载 dll B。
问题是,执行 Transform
方法后,我不断收到 找不到 dll B 的错误,即使在我调用 AppDomain 时它仍然存在.CurrentDomain.GetAssemblies();
请注意,如果我从 A 中删除 B 的依赖关系,则一切正常,因此我们可以确保仅使用 dll A 的 Transform
正常工作。
FileNotFoundException: Could not load file or assembly 'xxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
还有一件事,如果我将 dll B 添加到项目 Bin 文件夹中,那么它就可以工作,但是当然,我不能这样做,我这样做只是为了证明它可以工作。
最佳答案
关于c# - 程序集.加载+依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59646614/