views:

538

answers:

5

Hello,

My program is written in C# NET 2.0,it's using external functions from a dll written in C++ using Microsoft Visual Studio 2008 SP1. If I remove the dll from the directory the program is placed,the program crashes at the moment it should use the dll.That's normal.

But the users that are using my program get the same error at the same place without moving the dll.They all have C++ Redistributable 2008 from >here<

Does it happen because I made the program in .NET 2.0 instead of NET 3.5 or it happens ,because the redistributable should be an older version?

Edit:Note for me,the program runs fine.

>>new thread<<

A: 

The C++ Redistributable that you linked to looks like it is from the original release of Visual Studio 2008. If that changes with SP1, I could see that causing the crash. Maybe there is an updated version of the redistributable that your users need to install?

Andy
A: 

There's preciously little information in your question about the actual crash which could mean any of many things. In my experience with mixing .NET and native C++, many issues can occur in the side-by-side (SxS), especially if the DLL and the .NET application were built with different versions of the compiler.

You probably need to reproduce this problem on a local machine to debug it.

MadKeithV
A: 

Dependency Walker can be excellent for tracking down these sorts of problems. You can load a DLL into it and it will tell you if any of its dependencies are unavailable. Sometimes missing DLLs are not necessarily a problem (if you do not go down that code path), but it is so much better than guessing.

Jeremy
A: 

No difference in this context of using .NET 2.0 or 3.5.
Look in method where you link and export functions from C++ (if it unmanaged) If external functions had written on managed C++, look into signing and version of dll's

pocheptsov
+1  A: 

Its most likely the wrong runtime. Make sure you are distributing the correct one. These will always work on your dev box because the runtimes are in the path. For testing software, I use a windows xp virtual machine. I set up the virtual machine as a completely fresh install, install the components I know that I need (.NET framework, etc.), then run my installer. You will run into a surprising number of setup issues doing this.

Steve
I accepter your answer only ,because you mentioned VM Box.I used that.Please check my new question for more information.
John