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

.NET6中runtimeconfig.json的additionalProbingPaths致框架DLL探测异常求助

.NET 6迁移后第三方DLL子文件夹部署异常问题

我正在将一个包含大量DLL的项目从.NET Framework迁移至.NET 6,迁移工作已完成,但部署环节遇到瓶颈:我们希望将所有第三方DLL放置在子文件夹(通常命名为lib)中,这种部署方式在.NET Framework中可正常运行,但在.NET 6下无法沿用。

我们尝试使用.runtimeconfig.json文件中的additionalProbingPaths配置项作为替代方案,但遇到两个关键问题:

  • 无法直接将DLL复制到目标子文件夹使其生效,必须创建与NuGet包一致的复杂目录结构;该问题可通过编辑.deps.json文件解决,让所有DLL集中到指定文件夹。
  • 设置additionalProbingPaths后,程序似乎会针对**所有DLL(包括框架自带DLL)**仅在配置的路径中搜索,而非仅针对第三方包,最终导致框架DLL加载失败。

探测失效场景(设置additionalProbingPaths为子文件夹)日志

Considering entry [DevExpress.Xpo/22.1.5/DevExpress.Xpo.v22.1.dll], probe dir [], probe fx level:0, entry fx level:0
    Local path query exists C:\projects\OnLIMS 76\Bin\DevExpress.Xpo.v22.1.dll
    Probed deps dir and matched 'C:\projects\OnLIMS 76\Bin\DevExpress.Xpo.v22.1.dll'
Processing TPA for deps entry [Microsoft.Extensions.DependencyInjection, 2.0.0, lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.dll]
  Considering entry [Microsoft.Extensions.DependencyInjection/2.0.0/lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.dll], probe dir [], probe fx level:0, entry fx level:0
    Local path query did not exist C:\projects\OnLIMS 76\Bin\Microsoft.Extensions.DependencyInjection.dll
    Skipping... not found in deps dir 'C:\projects\OnLIMS 76\Bin\'
    Skipping... not found in probe dir ''
  Considering entry [Microsoft.Extensions.DependencyInjection/2.0.0/lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.dll], probe dir [C:\projects\OnLIMS 76\Bin\lib], probe fx level:-1, entry fx level:0
    Relative path query did not exist C:\projects\OnLIMS 76\Bin\lib\microsoft.extensions.dependencyinjection\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll
    Skipping... not found in probe dir 'C:\projects\OnLIMS 76\Bin\lib'
Warning:
  An assembly specified in the application dependencies manifest (OnWshPlugin.deps.json) was not found:
    package: 'Microsoft.Extensions.DependencyInjection', version: '2.0.0'
    path: 'lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.dll'

正常工作场景(未设置additionalProbingPaths)日志

Processing TPA for deps entry [DevExpress.Xpo, 22.1.5, DevExpress.Xpo.v22.1.dll]
  Considering entry [DevExpress.Xpo/22.1.5/DevExpress.Xpo.v22.1.dll], probe dir [], probe fx level:0, entry fx level:0
    Local path query C:\projects\OnLIMS 76\Bin\DevExpress.Xpo.v22.1.dll (skipped file existence check)
    Probed deps dir and matched 'C:\projects\OnLIMS 76\Bin\DevExpress.Xpo.v22.1.dll'
Processing TPA for deps entry [Microsoft.Extensions.DependencyInjection, 2.0.0, lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.dll]
  Considering entry [Microsoft.Extensions.DependencyInjection/2.0.0/lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.dll], probe dir [], probe fx level:0, entry fx level:0
    Local path query C:\projects\OnLIMS 76\Bin\Microsoft.Extensions.DependencyInjection.dll (skipped file existence check)
    Probed deps dir and matched 'C:\projects\OnLIMS 76\Bin\Microsoft.Extensions.DependencyInjection.dll'
Adding tpa entry: C:\projects\OnLIMS 76\Bin\Microsoft.Extensions.DependencyInjection.dll, AssemblyVersion: 2.0.0.0, FileVersion: 2.0.0.17205

此问题较为特殊复杂,希望有过类似经验的同仁提供可行解决方案。感谢!


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 20:55:28