C#应用程序安装问题

发布于 2024-10-14 21:53:00 字数 814 浏览 4 评论 0原文

我使用 Visual Studio 2010 和 .NET Framework 4.0 设计了一个 C# 应用程序 它在我的电脑上运行良好。 我使用 DLL 来连接 Oracle DB。 我为我的应用程序创建了一个安装项目来部署它,当我尝试在第二台 PC 上安装该应用程序时,它要求我安装 .NET Framework 客户端,我已经安装了它。 之后,当我尝试运行我的应用程序时,它可以工作,但每次代码尝试从 DLL 调用函数时,它都会引发异常:

System.IO.FileLoadException:无法加载文件或程序集“System.Data.OracleClient,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”或其依赖项之一

我将 DLL 添加到安装文件中,但它没有不工作。 我尝试将此代码添加到我的配置文件中:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <qualifyAssembly partialName="System.Data.OracleClient" fullName="System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </assemblyBinding>
</runtime>

但它也不起作用。请提供任何帮助。

I have designed a C# application using Visual Studio 2010 with .NET framework 4.0
and it works well on my PC.
I used an DLL to connect the Oracle DB.
I created a Setup project for my application to deploy it, when I tried to install the application on a second PC, it asked me to install the .NET Framework client, and I have installed it.
After that when I tried to run my application it works but each time the code try to call a function from The DLL it throws an exception:

System.IO.FileLoadException: Could not load file or assembly 'System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies

I added the DLL to the setup file, but it didn't work.
I have tried to add this code to my config file:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <qualifyAssembly partialName="System.Data.OracleClient" fullName="System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </assemblyBinding>
</runtime>

But it didn't work too. Any help, please.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光礼记 2024-10-21 21:53:00

我发现了以下内容:
答案
请检查第一个答案
可能导致此问题的原因是我在第二台 PC 上安装了 .NET4 Client Profile,而不是 .NET4 Full 框架

I have found the following:
Answer
please check the first answer
maybe this problem caused because I have installed the .NET4 Client Profile on the second PC not the .NET4 Full framework

云雾 2024-10-21 21:53:00

如果您确定 OracleClient-Dll 部署在第二台 PC 上,则问题出在“或其依赖项之一”部分。

至少当我上次(几年前)使用Oracle客户端时,它需要从Oracle安装CD安装额外的Oracle客户端Dll。这是因为 .NET Dll 只是一个调用部署在客户端 PC 上的客户端 Dll 的包装器。

顺便说一句:我们当时的解决方案(因为我们不希望客户安装 Oracle 客户端)是从 DataDirect。它们并不便宜,但它们在托管代码中实现了完整的数据访问,因此您实际上只需将一些 Dll 复制到您的应用程序文件夹中(如果您愿意,也可以复制到 GAC 中)。

If you are sure that the OracleClient-Dll is deployed on the second PC, then the problem is in the "or one of its dependencies" part.

At least when I used the Oracle client the last time (a few years ago) it required the installation of additional Oracle client Dlls from the Oracle installation CDs. That's because the .NET Dll was just a wrapper that called into the client Dlls deployed on the client PC.

BTW: Our solution at that time (because we didn't want our customers to install the Oracle client) was to buy the .NET Dll from DataDirect. They aren't cheap but they implement the complete data access in managed code, so you really need to just copy some Dlls into your application folder (or in the GAC if you want to).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文