You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio项目依赖配置异常:外部运行报错及AssemblyResolve后新问题

项目依赖项外部运行报错问题

我有两个项目,Project A需要依赖Project B才能运行。在Visual Studio中通过「Add dependency」的「Project」选项添加了该依赖项,构建解决方案时完全正常,但在Visual Studio外部运行Project A时,出现找不到依赖项的错误。

已尝试的解决操作

我通过订阅AssemblyResolve事件来处理依赖加载,主程序中代码如下:

AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;

同时实现了对应的处理方法:

private Assembly ResolveAssembly(object sender, ResolveEventArgs args)
{
    string name = args.Name.Split(',')[0];

    return Assembly.LoadFile(@"C:\ProgramData\Letitbim\" + name + ".dll");
}

重新构建项目并运行后,又出现了新的错误。

内容的提问来源于stack exchange,提问作者Thomas_Lcp

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 23:06:27