Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将具有依赖项v1的项目添加到具有依赖项v1.1的项目_C#_Asp.net_Dependencies - Fatal编程技术网

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

C# 将具有依赖项v1的项目添加到具有依赖项v1.1的项目,c#,asp.net,dependencies,C#,Asp.net,Dependencies,情况就是这样:我有一个项目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, C

情况就是这样:我有一个项目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时,我不会得到这个错误,只有在编译发行版时。 我如何解决这个问题

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

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,版本=1.0.0.0,区域性=中立,PublicKeyToken=null
引用程序集
DocumentFormat.OpenXml,版本=2.0.5022.0,区域性=中立,PublicKeyToken=31bf3856ad364e35
并且程序集加载程序无法找到它


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

按照消息末尾有关如何启用绑定日志记录的说明进行操作。然后使用Fuslogvw.exe检查失败的绑定。这只发生在生产环境中,因此我无法从cmd访问Fuslogvw.exe。您可以将Fuslogvw.exe复制到生产计算机。如果它不能直接工作,请按照中的说明打开它。@Panos Rontogiannis谢谢你的提示,我已经添加了fusion中的日志记录。我已经编辑了你的标题。请参阅“”,其中共识是“不,他们不应该”。@AMember然后您可能需要将程序集添加到GAC。您不能用有关这些程序集的更多详细信息更新您的问题吗。指定程序集及其全名(如DocumentFormat.OpenXml,Version=2.0.5022.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35)及其依赖项(引用的程序集)。另外,请让我们知道哪些程序集是您自己的,哪些是第三方的。我已通过更新所有环境的版本来解决此问题。无论如何谢谢你的帮助。。。