VS 2005 and Manifest for runtime dlls
Hi all,
I'm having some problems with Visual Studio 2005 and even though I read
everything I could find in MSDNL I still couldn't find the answer.
Mainly my problem is that even though the manifest needed for the MS
runtime library is embedded into the binary, the C:\Program
Files\Microsoft Visual Studio
8\VC\redist\x86\Microsoft.VC80.CRT\Microsoft.VC80.CRT.manifest is still
needed.
Detailed: I did the following steps:
1) New Project -> Win32 Console Application -> Empty project
2) Add new .cpp file with some code (as easy as possible), eg:
#include <stdio.h>
void main() { printf("MOMO"); }
3) Build the project in Release
4) Open the built .exe in the Visual Studio IDE (File -> Open -> File)
=> we can see the RT_MANIFEST being indeed 1, as suggested by MSDNL,
which means the manifest is embedded into the binary.
5) Copy this new binary, eg coco.exe on a Windows XP system with no
Visual Studio installed
Now there are the following scenarios:
a) Run coco.exe on that machine => error "The system cannot execute the
specified program.", when run from cmd prompt, or "This application has
failed to start because the application configuration is incorrect.
Reinstalling the application may fix this problem.", when double-clicked
in explorer. Not working might be normal as there are no runtime DLLs
b) copy the C:\Program Files\Microsoft Visual Studio
8\VC\redist\x86\Microsoft.VC80.CRT DLLs (msvcp80.dll and msvcr80.dll) on
the target machine in the same directory like the coco.exe and try again
to run coco.exe => the errors like above.
This is what I don't understand. Why isn't this enough taking in account
that the manifest is embedded in the binary?
c) If I also copy in the exact same directory where the DLLs and
coco.exe are the file Microsoft.VC80.CRT.manifest from C:\Program
Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT,
running coco.exe will work. But doesn't that mean that I have an
external manifest? If yes, this is not what I want, as in MSDNL is
stated that having an external manifest is not a good idea as this won't
work if you load a DLL via LoadLibrary, so I want the manifest embedded.
In other words, can somebody pls:
I) explain why the scenario b) is not working
II) the C:\Program Files\Microsoft Visual Studio
8\VC\redist\x86\Microsoft.VC80.CRT\Microsoft.VC80.CRT.manifest is always
needed? Does this mean external manifest or not?
III) what do I need to do in order to deliver on the target machine the
DLLs in the same directory where the app is? (not WinSxS, and not a
subdirectory of the application directory)
Thanks in advance,
Viv