Reputation: 2333
I have a C# project that I have created in Visual Studio Express 2010. This program uses a 3rd party C# class that relies on/calls a C++ dll. I just copied the filename.dll into the bin/debug and bin/release folders of the project folder, and the application ran fine.
I am under the assumption that I can copy the release executable for the project to another computer and run it as long as the filename.dll is in the same directory as the executable. However, trying this on another computer with correct frameworks installed, etc. the program crashes with a system.dllnotfoundexception.
Strangely, my friend reports that the program runs on his computer with Visual Studio installed, but not the one without, though I have not actually seen this.
What could be causing this? And how can I get the release executable to run on another machine?
Thanks for any replies! -Chase
Upvotes: 3
Views: 1138
Reputation: 17837
If your c++ dll is build by visual studio it may depends on the CRT, two things to check here :
In any case the best way to debug such problems is to install Dependency Walker (free) on the computer having problems and let it tell you what dll is missing.
Upvotes: 1
Reputation: 60564
The easiest (albeit maybe not the "best") solution to this problem is adding a Setup project to your solution. A setup project will help you find any dependencies, and make them available during install.
The steps you need to take are the following:
Now when you compile, an .msi installer is created. Run this installer on the other computer, and your program will be installed and runnable. To uninstall, run the installer again, or remove the program from "Add/Remove programs" under Control panel.
Upvotes: 0
Reputation: 117220
Make sure you have the Visual C++ runtime installed (VS2005,VS2008,VS2010).
Upvotes: 4