【问题标题】:system.dllnotfoundexception without VS 2008没有 VS 2008 的 system.dllnotfoundexception
【发布时间】:2013-05-06 12:11:46
【问题描述】:
我的 C# 代码加载了一个 C++ DLL。它在我安装了 Visual Studio 2008 的 PC 上运行良好。但在其他机器上,程序会异常停止
Unhandeled exception: system.dllnotfoundexception unable to load dll ...
this application has failed becasue the application configuration is incorrect....
如何让这段代码在没有安装 VS 2008 的机器上运行?
【问题讨论】:
标签:
c#
c++
visual-studio-2008
dll
【解决方案1】:
如果您的项目是您的自定义 DLL,您必须将您的 DLL 与您的项目一起分发。如果没有,您必须使用自定义安装程序安装所需的 DLL,或者如果它来自不同的提供商,则必须安装它们的安装程序。
This 的帖子可能有点旧,但是
DLL 文件和 .NET ClickOnce 部署
我想将我的一个 .NET 应用程序部署为 ClickOnce 应用程序。问题是我正在连接到 Oracle(请参阅此处和此处的以前的帖子)。连接到 Oracle 至少需要 4 个 DLL 文件,这些文件通常必须与 EXE 文件位于同一目录中。问题是当程序发布时,DLL 没有以任何方式被引用,所以程序将无法运行。
然后我阅读了有关将文件添加到项目中的内容,以便 ClickOnce 和发布处理器确定需要 DLL 并将它们添加到清单中。
Here is the process in Visual Studio 2005:
1. Put the 4 DLL files in their own directory in your solution directory (for ease of use mostly).
2. Add all four files to your project by going to “Project->Add Existing Item…”
3. Click on each DLL file in the solution explorer and then change their property: “Copy To Output Directory” to “Copy Always”.
就是这样!现在,当我发布甚至运行应用程序时,我不必担心 DLL 文件是否在它们应该在的位置。
【解决方案2】:
在与 2008 年的项目中:
属性>c/c++>运行时库>选择:多线程调试(/MTd)