Reputation: 347
I created a client server application in C++ using Visual Studio.
Now I want to run the client EXE file on another computer (which doesn't have Visual Studio installed), but when I try run the EXE file, it gives the following error message:
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
How can I run the EXE file without installing anything on the computer?
Upvotes: 26
Views: 75385
Reputation: 1119
I am running Visual Studio 2019 and I found a very helpful configuration property to address the problem of moving a simple application to another computer without an installation package.
Rebuild your project. All the necessary dlls will be copied to the project’s output directory. Copy your exe and all dlls to another computer. The exe should find everything it needs to run.
Upvotes: 1
Reputation: 347
I deployed my program in release instead of debug, and the EXE file now works on the other computer.
Upvotes: 8
Reputation: 24756
Background:
Solution:
Finally by anyway the target computer should have the exact run time assemblies. There are a few ways to do this (for more details search each in Google).
Conditions:
Upvotes: 13
Reputation: 42133
Applications built with Visual Studio depend on Visual C++ Redistibutable (VCRedist). When the program is being linked dynamically, then your binaries will need
MSVCR**.dll
(Microsoft C Runtime Library).
On MSDN, there is a nice article called Redistributing Visual C++ Files (for Visual Studio 2008), that states that there are Potential run-time errors in case that required Visual C++ library is not installed:
Basically you have two options:you may get one of the following error messages depending on the version of Windows on which you try to run your application:
- The application failed to initialize properly (0xc0000135).
- This application has failed to start because the application configuration is incorrect. Reinstalling application may fix this problem.
- The system cannot execute the specified program.
But your application might depend on other DLL files as well. In case you want to find out what are the dependencies of your program, there is a great utility called Dependency Walker that will help you in this and many other situations :)
Upvotes: 30
Reputation: 950
I haven't seen that specific error before. Usually it's an error around a missing DLL (Windows redistributable). Assuming there isn't actually a problem with the configuration, you have two choices:
Change the compile mode from Multithreaded DLL to Multithreaded. This can be done from the C++ section of project properties under code generation. In multithreaded mode your binary will be statically linked against the Windows redistributable. This is probably what you want.
Install the Windows redistributable on the target machine. This probably isn't OK, because you state that you don't want to install anything on the target machine.
A warning about option 1: Different versions of Windows have different versions of the redistributable. It's possible to encounter a highly specialized environment in which a statically linked program will not behave as expected.
Upvotes: 6
Reputation: 6992
It look like you're missing some DLL files. Be sure to copy appropriate DLL files along with EXE file.
Upvotes: 3