Stimulsoft,未找到程序集 'Stimulsoft.Data'

Stimulsoft, assembly 'Stimulsoft.Data' is not found

我已将 stimulsoft 报告版本从 2014.3.0.0 升级到 2021.1.1(从 Nuget 包管理器安装 Stimulsoft.Reports.Web 2021.1.1)并添加代码以生成 pdf 报告。 它在本地实例上运行良好,但在部署到实时时抛出程序集错误。

错误如下:

System.IO.FileNotFoundException: Could not load file or assembly 'Stimulsoft.Data, Version=2021.1.1.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a' or one of its dependencies. The system cannot find the file specified.
File name: 'Stimulsoft.Data, Version=2021.1.1.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a'
   at Stimulsoft.Report.StiNameValidator.CorrectName(String str, Boolean checkKeywords, StiReport report, Boolean isDataExpression)
   at Stimulsoft.Report.StiReport.GetReportName()
   at Stimulsoft.Report.StiReport.ScriptNew()
   at Stimulsoft.Report.StiReport.Clear(Boolean generateNewScript)
   at Stimulsoft.Report.StiReport.LoadPackedReport(Stream stream)
   at Stimulsoft.Report.StiReport.LoadPackedReport(Byte[] bytes)

谁能推荐一下?

我认为您缺少更新的程序集重定向。参见:https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions

这就是我在 web.config 中要做的事情:

<configuration>
<runtime>
 <assemblyBinding ...>
<dependentAssembly>
  <assemblyIdentity name="Stimulsoft.Data"
    publicKeyToken="ebe6666cba19647a" />
  <bindingRedirect oldVersion="2014.3.0.0" newVersion="2021.1.1.0" />
</dependentAssembly>
 </assemblyBinding >
</runtime>
</configuration>

这可能是构建和部署问题,解决方案取决于您构建和部署应用程序的方式。这就是我要做的:

  1. 检查旧 dll 2014.3.0.0 是否是生产服务器中 bin 文件夹中的那个。如果是这种情况,那么您可能没有更新项目中的所有引用。

  2. 新旧 dll 都不在 bin 文件夹中。这可能是因为构建服务器上缺少 nuget 恢复步骤。

  3. 新dll 2021.1.1在bin文件夹下。这意味着 bin 文件夹中缺少 它的一个依赖项 。要找出缺少哪个依赖项,您需要反编译 Stimulsoft.Reports.Web 2021.1.1 dll 并检查该 dll 中列出的所有引用是否位于 bin 文件夹中。如果没有,那么您需要手动将对丢失的 dll 的引用添加到您的项目中。

注意:我使用 ILSpy 进行反编译。

这是部署问题。 MsBuild 在构建应用程序时不包括间接引用。所以,我刚刚更新了清单文件并解决了问题。