【问题标题】:Can not load file or assembly on SharePoint 2013 Farm Solution无法在 SharePoint 2013 场解决方案上加载文件或程序集
【发布时间】:2020-05-23 10:15:53
【问题描述】:

我们为 SharePoint 2013 开发了一个场解决方案,该解决方案使用第三方 dll,例如部署在 WebApplication Scope 而不是 GAC 下的 Newtonsoft.Json。还有其他供应商已经在 WebApplication Scope 下部署了农场解决方案,这些解决方案引用了相同的 dll 文件,但版本要旧得多,并且没有更新它们的计划。 作为防止我们的应用程序覆盖常见 dll(如 Newtonsoft.Json)的解决方案,我们更新了 Package Manifest 以将 dll 部署到网络服务器 bin 文件夹上的自定义目录中。 但是在执行时我们得到以下错误:

无法加载文件或程序集 Newtonsoft.Json 或其依赖项之一。系统找不到指定的文件。

我们如何解决这个问题?任何帮助表示赞赏。

截图供参考:

【问题讨论】:

  • 请尝试将“复制本地”设置为 true,以确保 dll 在输出文件夹中,因为将部署此解决方案。
  • 我已经将“复制到本地”设置为 true。我在“自定义”目录下的 bin 文件夹中看到它。 ??????

标签: c# asp.net sharepoint sharepoint-2013


【解决方案1】:

从解决方案中删除原始本地 dll。

然后尝试使用 Nuget 命令安装 Newtonsoft Json 包:

安装包 newtonsoft.json

重新构建并部署解决方案,看看它是否有效。

【讨论】:

    【解决方案2】:

    似乎问题在于 CLR(公共语言运行时)无法定位和绑定引用的程序集,因为它被放置在自定义目录中。

    最终在 web.config 文件中注册了自定义目录:

    <configuration>  
       <runtime>  
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">  
             <probing privatePath="bin;bin\Custom"/>  
          </assemblyBinding>  
       </runtime>  
    </configuration>
    

    要了解有关探测的更多信息,请参阅Probing 上的 Microsoft 官方文档

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多