gpt4 book ai didi

c# - "Copy Local = false"引用的项目显示 "Could not load file or assembly"

转载 作者:太空宇宙 更新时间:2023-11-03 16:10:00 27 4
gpt4 key购买 nike

我花了几天时间寻找答案,但还没弄清楚会发生什么。

我有一个包含 4 个项目的解决方案。其中一个引用了其他 3 个。所有引用都设置为“copy local = false”。

我已经为它们每个制作了输出文件夹并且一切都很顺利,直到我决定更改输出文件夹。 :-(

现在,当我将项目引用到另一个具有属性“copy local = false”的项目时,项目不会加载并且我有一个错误提示

Could not load file or assembly "..." or one of its dependencies. The system cannot find the file specified.

从错误的 FusionLog 中,我非常确定 Studio 仍在旧路径中寻找项目的 .dll。

当我设置“copy local = true”时,项目运行但此解决方案 Not Acceptable 。

我应该怎么做才能在复制本地设置为 false 的情况下再次加载我的项目?如何更改 Visual Studio 正在查找的路径?是否有我可以清除或更新的缓存?

提前感谢您对此提供的任何帮助。

最佳答案

将其添加到您的依赖项目的 app.config(即依赖于其他项目的项目):

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="*relative path to assemblies here*" />
</assemblyBinding>
</runtime>

将“这里的程序集的相对路径”替换为构建程序集的实际相对路径(您的新输出文件夹)。

MSDN

关于c# - "Copy Local = false"引用的项目显示 "Could not load file or assembly",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17837609/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com