将 ACE OLEDB 12 驱动程序包含在 clickOnce 安装中
我在 Visual Studio 2010 中开发了一个 C# winform 应用程序,该应用程序连接到 Access 2010 *.accdb 数据库。它在我的电脑上运行良好,但当我将其安装在另一台电脑上时,它会抛出错误“‘Microsoft.ACE.OLEDB.12.0’提供程序未在本地计算机上注册。” 我尝试按照建议将其编译为 x86,但没有成功。
感谢任何帮助/建议,我认为我应该将此驱动程序作为我的 clickOnce 安装的一部分。如果是这样,我该怎么做? (它不会作为选项出现在 VS 属性 > 发布 > 以前的需求中的需求清单中)
I have developed a C# winform application in Visual Studio 2010 that connects to a Access 2010 *.accdb database. It works fine on my pc but when I install it on another, It throws the error "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."
I tried to compile it to x86, as advised, without any succes.
Any help/advice is appreciated, I think that I should include this driver as part of my clickOnce install. If so, how do I do so? (It does not appear as an option in the checklist of requirements, in VS Properties > Publish > Previous requirements)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您将必须使用更高级的方法来部署必要的驱动程序 - 据我所知,ClickOnce 本身不会这样做。我也不认为它像单个 DLL 那么简单。驱动程序需要向系统注册等。Access
驱动程序由于其设置方式而存在一个大问题。如果用户安装了带有 Access 的 Microsoft Office,则他们已经拥有 ACE 驱动程序。问题是,如果他们在 64 位计算机上安装了 32 位 Access,则您的 64 位应用程序将无法与 Access 通信,因为该计算机只有 32 位驱动程序,并且您无法同时安装两者。
如果您的用户都没有使用 Access 的 Microsoft Office,那么您应该能够根据需要为每台计算机部署 32/64 位的独立驱动程序安装程序。
You will have to use a more advanced method of deploying the necessary driver - ClickOnce won't do it by itself as far as I know. I also don't think it's as simple as a single DLL. The driver needs to register with the system etc.
There is a big issue with the Access drivers because of the way they are set up. If the user has Microsoft Office with Access installed, they will already have the ACE driver. The problem is, if they have 32 bit Access installed on a 64 bit machine, your 64 bit application will not be able to talk to Access because the machine only has a 32 bit driver, and you cannot install both.
If none of your users have Microsoft Office with Access, then you should be able to deploy the standalone driver installer for 32/64 bit as necessary with each computer.
通过将任意程序集和文件添加到项目并将其文件类型更改为内容,可以将任意程序集和文件作为 ClickOnce 安装的一部分包含在内。然后它们将出现在应用程序文件列表中。
请注意,如果执行此操作,您将收到 Visual Studio 发出的警告,但可以安全地忽略它。
It is possible to include arbitrary assemblies and files as part of your ClickOnce install by adding them to the project and changing their file type to Content. They will then appear in the list of Application Files.
Note that you'll get a warning from Visual Studio if you do this, but it can be safely ignored.
您可以构建一个 msi 而不是 oneclick,并创建一个自定义操作,以安静模式安装 ace 驱动程序。由于它是可执行文件,因此您可以在进程对象中运行它
You can build an msi instead of oneclick and create a custom action that would install ace driver in quiet mode. Since its an executable you can just run it in a process object