gpt4 book ai didi

c# - 将具有依赖项 v1 的项目添加到具有依赖项 v1.1 的项目

转载 作者:行者123 更新时间:2023-11-30 17:08:21 26 4
gpt4 key购买 nike

情况是这样的:我有一个项目 A,它依赖于库版本 1.0.0.0这个版本将保留在这个项目中是至关重要的。对于一些额外的功能,我需要使用库 1.1.0.0,因此我创建了一个具有较新版本的类库项目并将其作为依赖项添加到我的主项目中。这工作正常并且很好地遵守,但在运行时我收到错误:

System.IO.FileLoadException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at OpenXMLReportsGenerator.GenerateInvoiceFailureReportHEOpenXML.CreatePackage(String filePath, DataSet data, String exporterName)
at bDoxWebEd.Reports.InvoiceFailureReportHandler.BeginGenerateReportAndSave(Object gerateReportStateInfo)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

将项目编译为 debug 时,我不会出现此错误,只有在编译 Release 时才会出现。我该如何解决这个问题?

好的,在服务器上激活日志记录功能后,我的日志中出现以下错误:

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Windows\SysWOW64\inetsrv\w3wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = IIS APPPOOL\bDoxPool
LOG: DisplayName = DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///D:/***/
LOG: Initial PrivatePath = D:\***\bin
Calling assembly : OpenXMLReportsGenerator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Program Files\Nipendo\bDox\bDox\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/bdox/00aaf85b/66058ca1/DocumentFormat.OpenXml.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/bdox/00aaf85b/66058ca1/DocumentFormat.OpenXml/DocumentFormat.OpenXml.DLL.
LOG: Attempting download of new URL file:///D:/***/bin/DocumentFormat.OpenXml.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

最佳答案

显然 OpenXMLReportsGenerator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 引用程序集 DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35并且程序集加载程序无法找到它。

尝试将此程序集添加到 bin 文件夹或 GAC。

关于c# - 将具有依赖项 v1 的项目添加到具有依赖项 v1.1 的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13796468/

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