Office365 升级后无法搭建访问数据库 - EFCore + Visual Studio 2019

问题描述 投票:0回答:1

我花了过去三个小时尝试解决此问题但无济于事,因此我来这里寻求帮助。我之前已经搭建了该数据库的一个子集,但在此之前是在从 32 位 Office 2010 升级到 64 位 Office 365 之前。完整详细信息如下:

环境

  • 数据库是 Access 数据库(.mdb 文件)
  • Visual Studio 2019
  • Office 365 - 64 位(已安装 Access)
  • Windows 10 64 位
  • EF 套餐:
    • EntityFrameworkCore.Jet 3.1.1
    • Microsoft.EntityFrameworkCore 3.1.32
    • Microsoft.EntityFrameworkCore.Design 3.1.32
    • Microsoft.EntityFrameworkCore.Tools 3.1.32

最初的问题:

Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))

经过大量研究,我将最初的问题范围缩小到系统无法找到 MS Access DAO dll。修复 O365 软件包无法解决该问题。经过绝望的措施,我调查了注册表中的 ID,发现它指向 Access 2010 32 位运行时的旧 dll 位置。

尝试的解决方案

更新注册表以指向 O365 附带的新 dao dll 允许一些小的进展:

Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following error: 800700c1  is not a valid Win32 application. (0x800700C1)

所以在这个阶段,我知道我已经能够成功指向一个dll,但是由于VS2019是32位应用程序,因此由于我的O365提供了64位dll而失败。尝试将我的应用程序编译为 64 位完全失败,因为脚手架告诉我它无法与 64 位应用程序一起使用(因为它通过 VS2019 运行,这是 32 位)。

Could not load file or assembly '[MyAssembly], Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format.

尝试2

如果您有 Office365 即点即用,Microsoft 会阻止安装任何其他运行时,因此我无法安装之前可用的 32 位运行时。所以我只是解压运行时安装程序,并直接指向dll。这取得了更多进展,但导致 dll 无法初始化。

Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following error: 8007045a A dynamic link library (DLL) initialization routine failed. (0x8007045A).

前进

此时,除了在尚未升级到 O365 的计算机上进行脚手架之外,我不知道还能做什么才能重新获得搭建脚手架的能力。

  • 有没有办法以 64 位运行脚手架进程?这肯定会解决依赖性问题,因为我安装了 64 位运行时。我无法找到答案,这是我的第一直觉。
  • 显然我可以将数据库迁移到 SqlServer 并从那里做脚手架(这是我想做的),但公司内的某些参与者目前正在无限期地阻止这种迁移,所以目前我必须处理访问分贝。

编辑:继续尝试,每次尝试 64 位时都会出现此错误。

Microsoft.EntityFrameworkCore.Design.OperationException: Could not load assembly '[MyProject]'. Ensure it is referenced by the startup project '[MyProject]'. ---> System.BadImageFormatException: Could not load file or assembly '[MyProject], Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format. 

脚手架不兼容 64 位。

c# .net entity-framework-core office365 com-interop
1个回答
0
投票

以下错误消息表明您的 Windows 注册表项已混乱:

Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following error: 8007045a A dynamic link library (DLL) initialization routine failed. (0x8007045A).

要恢复丢失的 Windows 注册表项,您需要修复/重新安装 MS Office。在处理 MS Office 应用程序时,这是一个广泛存在的问题。

© www.soinside.com 2019 - 2024. All rights reserved.