views:

1210

answers:

3

HI I have creted an exe by c++ using visualstudio. I have creted a com componet which discover all the instances of sqlserver on particular machine.now in c++ program using visualstudio i write main() and consume the com component.

Now it should worrk on my both workstations which are w2k3 machines.And when i try to run the same on w2k8 machine i got the error as

the application has failed to start because the side by side configauration is incorrect and for details see the application event error log

i open the application error log and found the error as

Activation context generation failed for "E:\SQLDiscovery.exe". Dependent Assembly Microsoft.VC80.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50608.0" could not be found. Please use sxstrace.exe for detailed diagnosis.

How to resolve this one plz help me

+4  A: 

You have to install the VC8 Runtime on W2k8. This is due to Windows Side by Side configuration. When you build and EXE, a special file is generated called "manifest", this manifest file describe the version of the C runtime library that is needed by your application in order to run correctly.
The Manifest is then embedded into your exe/dll ( if you actually opened the .dll/exe using notepad and scrolled to the end, you will see it in xml format), you cal also use mt.exe ( manifest tool ) to view the manifest inside any executable.

When you move your application to W2k8, you have to ensure the dependent CRT is installed ( unless you statically link your app with CRT).

You can resolve this issue by either one of these 1- Install VC8 Debug CRT 2- Build you app as statically linked

Check out this blog as well http://detritus.blogs.com/lycangeek/2006/08/diagnosis_of_wi.html It contains useful information about how to debug winsxs issues.

Hope this helps

mfawzymkh
Please let me know if this helps your issue.
mfawzymkh
Build you app as statically linkedHow to do this plz tell me
Cute
when you build it in VS, go to projects->settings->C/C++->Code Generation and choose Runtime Lib options to be /MTd instead of /MDd
mfawzymkh
Note this will increase the size of your DLL/EXE.Let me know if it worked for you.Thanks
mfawzymkh
Hi worked fine.. And i have the new issue. Rather than displaying the result it shows the foolowing error Debug error:program: c:\SqlDicovery.exe This program has requested a runtime to terminate it an unusualway please contact the applications support team for more informationHow to resolve this one
Cute
plzz observe--->http://stackoverflow.com/questions/981447/debug-error-runtime-needed-for-name-exe-occurs-while-cusing-com-in-vc-proje
Cute
You will need to debug to figure out the call stack at the point of failure.you can do that by attaching windbg when you see the assert dialog, or running you app under windbg.you can download windbg ( Debugging Tools for Windows ). It should be easy to runMake sure you build you application in debug mode , and copy the .PDB file as well so that you got full symbols.
mfawzymkh
Ohh sorry some info i have missed. The exe i have developed using win2k3 32 machine and i tried to run on w2k8 64 bit machine is it the reson for theat debug error?????(32 bit machine exe i tried to run on 64 bit machine )
Cute
mm, this shou ld not be an issue, however you mentioned there is a com object involved, so you might want to make sure you are running you application under the WOW and make sure to register your COM object from a WOW command window, Let me know if it worksThanks
mfawzymkh
WOW command window means?? i Didn't understood.
Cute
Sorry I didn't explain.WOW means (Windows On Window), it is a technology that allows you to run 32bit application natively in 64bit environment. You can open a WOW window from %windir%\Syswow64\cmd.exeThanks
mfawzymkh
A: 

The problem is that the EXE requires the debug CRT DLLs and they are not present on the 2008 machine. How you fix this depends on what you want/need to do.

If you want to use the debug CRT, either link statically to the CRT (removing the need to have the DLLs on the 2008 machine) or create a directory called "Microsoft.VC80.DebugCRT" in the same directory as the EXE, and put the necessary DLLs and the debug CRT manifest file there.

The debug CRT is not redistributable, AFAIK there is no way to "install the debug CRT" other than installing all of Visual Studio.

If you don't actually need the debug CRT, link with the release version. Again, you'll need to choose between the static LIB and the DLL version. The good news is that the release CRT is redistributable, check your Visual Studio install directory for vcredist_x86.exe.

Michael Dunn
A: 
  1. Don't ship debug builds. Build it in release, and then put that on your target machine.
  2. If you use the CRT (you do) then you need to install the CRT redistributables. You need to install (on the target machine) the ones which match the version & SP of the compiler you used to build the application. It's very simple & standard practice

Here's a link where you can get the redists for VC8: link And here's a link for the redists for VC8 SP1: link text

Just google "vc8 redist" or whichever version you are using and you will find your way.

  1. Don't statically link your app just to avoid having to install the redists.
John Dibling