Tuesday, May 26, 2009

Visual C++ Debug Executables On Nondeveloper Machines

Well, If you need only facts then: Debug builds in Visual C++ include dependency on Microsoft.VC90.DebugCRT.dll which is installed with Visual C++ environment. This builds will not run on client machines even with Visual C++ Runtine Redistributable installed. Only Release build will run on such machines.
And here is the history how did I found this.
Recently I found that I couldn't start my application written in C++ on my netbook. At first I thought that this was the problem with hardware: program was compiled on 64-bit OS and machine and I was trying to run it on 32-bit machine. However I've tried to run program on another 32-bit machines and an attempt was succesfull. But on the forth machine it again failed to start. And by the way it provided a rather meaningless message which suggested to reinstall the problem. In .NET applications such an error is displayed if *.config file of executable has en error in XML syntax. but the was no any *.config file in this application.
I've assumed that there are missing dll file. So I've installed the only dependency that could be in this simple application: Microsoft Visual C++ 2008 Runtime Reditributable. That didn't helped. I've installed 2008 SP1 version. The same result. So I've tried to read the manifest file and found the dependency on Microsoft.VC90.DebugCRT.dll. I've compiled my application as a Release build and manifest included dependency on Microsoft.VC90.CRT.dll and application was starting on all required machines! It seems that debug vresion of C Runtime is distributed only with developer environment.
So the summary: Visual Stusio (or at least Visual C++ Express) is required to be installed to run Debug builds of programs.

No comments: