使用 oracle dll 部署 Wix

Wix deployment with oracle dlls

我是 .net 应用程序的新手,我正在尝试将 winforms 应用程序部署到多台计算机(32 位和 64 位),而不必在每台计算机上安装 oracle 客户端。 我在 Oracle.DataAccess.dll 中使用 oracle 11g。 我在我的解决方案中创建了两个 wix 项目(设置和引导程序)。 我的解决方案还有另外 4 个项目:MyMainForm 项目、MyService 项目、MyDAO 项目和 MyDataModel 项目。 在 MyDAO 项目中,我引用了 Oracle.DataAccess.dll.

第一个问题: 我应该将 Oracle.DataAccess.dll 文件放在我的解决方案中的什么位置以添加引用? 我放入 MyMainForm 项目的 bin\Release 文件夹。 连同 oci.dll、oramts.dll、oramts11.dll、orannzsbb11.dll、oraocci11.dll、oraociei11.dll 和 OraOps11w.dll 文件。 它在我的机器上工作,但我不确定这是否是放置它们的正确位置。

第二个问题: 当我将它安装在我的机器上时(64 位)可以正常工作。但是当我在另一台机器(也是 64 位)上安装时,它不起作用。 我收到以下错误:

System.IO.FileNotFoundException was unhandled Message: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in MyService.dll Additional information: Could not load file or assembly 'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

我认为这与第一个问题有关。可能文件放错地方了。

第三题: 我读到了 Oracle.ManagedDataAccess.dll。对于我读到的内容,我只会使用这个 dll 而不是所有其他 dll,我不应该担心 32/64 位。 但是我可以将它与 oracle 11g 一起使用吗?

我在论坛上阅读了很多关于它的内容,但没有找到好的教程或类似的教程来完成这项工作。 我现在已经为此苦苦挣扎了大约 3 天。

如有任何帮助,我们将不胜感激。

我修复了它,但我不确定确切的错误是什么。

我做了三件事:

1 - 六个项目中有两个配置为"Any CPU",其他配置为"x86",我将"Any CPU"的配置为"x86"(不能记得有哪些,我相信是 MyService 项目和 MyDAO 项目,但不确定)。

2 - 在MyDAO项目的.csproj文件中,oracle引用是这样的:

<Reference Include="Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86" />
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\MyMainForm\bin\Release\Oracle.DataAccess.dll</HintPath>
</Reference>

但是我用的.dll文件版本是4.112.3.0,所以我改成:

<Reference Include="Oracle.DataAccess />
  <SpecificVersion>False</SpecificVersion>
  <Private>False</Private>
  <HintPath>..\MyMainForm\bin\Release\Oracle.DataAccess.dll</HintPath>
</Reference>

3 - 我更改 Product.wxs 以包含 oracle dll,如下所示:

  <!-- Oracle libraries -->
  <Component Guid="*">
    <File Source="$(var.MyMainForm.TargetDir)\Oracle.DataAccess.dll" KeyPath="yes" />
  </Component>
  <Component Guid="*">
    <File Source="$(var.MyMainForm.TargetDir)\oci.dll" KeyPath="yes" />
  </Component>
    <Component Guid="*">
    <File Source="$(var.MyMainForm.TargetDir)\oramts.dll" KeyPath="yes" />
  </Component>
    <Component Guid="*">
    <File Source="$(var.MyMainForm.TargetDir)\oramts11.dll" KeyPath="yes" />
  </Component>
    <Component Guid="*">
    <File Source="$(var.MyMainForm.TargetDir)\orannzsbb11.dll" KeyPath="yes" />
  </Component>
  <Component Guid="*">
    <File Source="$(var.MyMainForm.TargetDir)\oraocci11.dll" KeyPath="yes" />
  </Component>
    <Component Guid="*">
    <File Source="$(var.MyMainForm.TargetDir)\oraociei11.dll" KeyPath="yes" />
  </Component>
  <Component Guid="*">
    <File Source="$(var.MyMainForm.TargetDir)\OraOps11w.dll" KeyPath="yes" />
  </Component>

这样我就不必在每台机器上都安装 Oracle Client。