MSVCR80D.dll not found

I ran in to this couple of days back.
Visual Studio 2005 threw up the following error message when i ran my CRT Win32\Console application in Debug mode.
---------------------------
<App Name> - Unable To Locate Component
---------------------------
This application has failed to start because MSVCR80D.dll was not found. Re-installing the application may fix this problem.
---------------------------
OK
---------------------------
The app ran fine in Release mode though.

(BTW, The error message, the title and the OK were automatically generated!! we can 'copy' the entire content of a error dialog by pressing CTRL-C when the dlg is active)

The most interesting/worrying aspects of this were the facts that this application is a 'straight-from-the-wizard' application and that the app worked sporadically on repeated trials of clean-and-rebuild project. Repeated attempts of install/reinstall/repair didn't fix this.

Searching the net for similar issues led me to this https://forums.microsoft.com/msdn/ShowPost.aspx?PostID=15218

So, according to the posts, the issue was due to a missing manifest file. But i was able to see two manifest files in the debug folder. In fact there are 2 debug folders. 1 in the <solution folder>\debug and the other <solution folder>\<project folder>\debug. The <solution>\debug contains the final output file and the <solution>\<project>\debug contains intermediate files. The .manifest files are present in the inner debug folder. I copied the '.embed.manifest' file to the outer debug folder and renamed it to <app name>.manifest. The app ran fine now. However, the fact that I had to manually do this meant that there was something wrong with this.

I started fiddling around with the project options and found that there is an option to ensure that the manifest is not embedded and its created externally. The setting is found in 'Project Properties->Configuration Properties->Mainfest Tool->Input and Output->Embed Manifest' . This is set to 'YES' by default. When this is set to NO the manifest is created in the outer debug directory and the app runs fine. Interestingly the app runs fine in the release version even when the manifest is embedded.

Resolution : Either of the following would fix this

1) Copy the <appname>.exe.embed.manifest from the inner debug folder to the outer debug folder and rename it to <appname>.exe.manifest. This is more of a hack. To ensure consistency between the executable and the manifest the manifest has to be copied everytime it can change. Use this reolution only when you specifically want an embedded manifest. ( setup a command line in the post build options to do this)

2) Set the 'Embed Manifest' option to 'NO' for the debug version. (This would mean when you move(or ship) your debug executable to some other machine you have to move(or ship) the manifest file also.)

As of now, This looks like some sort of a bug in the creation of a debug executable with embedded manifest. I will update here if get to know something more.