views:

83

answers:

5

I have created an application using VB.NET in VS2008. When I run the app in the IDE on my development machine it works fine. It also works fine when I build it and run it as an exe on any machine that also has Visual Studio installed (at least 2005 and 2008 anyway) However, when I try to run the compiled executable on any machine without Visual Studio it throws up an error "[program name] has encountered a problem and will close..."

Does anyone have any thoughts on this.

Thanks

+1  A: 

It is possible that you have libraries in your GAC that are not present on machines that don't have visual studio installed. Check what libraries you are referencing and try adding dlls directly to your project.

empi
A: 

The error message you describe is a memory violation of some sort. But there's too little information to identify what the problem is.

To identify the problem, write a "hello world" program and see if you can reproduce the error. Include all of your using statements. If it still fails, I would make sure that all of the necessary libraries are available on your target machine. You can put them into the same folder as your executable for testing purposes.

If that goes OK, you should start blocking out parts of the code to prevent them from executing (either by commenting them out or using return statements), and attempt to reproduce the problem. When the problem goes away, the last block of code that you commented out is the one with the error.

Robert Harvey
Thanks Robert. It was actually a stupid oversight on my part. There is a third party dll that is a dependency which it appears must be registered on the client machine. I found this after implementing your Hello World suggestion. At this stage I just manually registered it on the test client machines and everything is fine.Cheers
Gerry
A: 

You can run a reflector at the EXE on the PC without VS installed. It can tell you the dependent assemblies and whether you can check if you have them on that system.

o.k.w
+1  A: 

I'll ask the proverbial "Is is plugged into the wall?" question: Does your target machine have the .Net framework installed? VB.Net programs require that the .Net framework runtime is installed to function.

Joel Coehoorn
A: 

There are a ton of reasons that the app could crash like

  • missing a resource/config file
  • the target machine might not have the necessary version of the .Net framework
  • the app could be compiled for amd64 and you're trying to run it on an x86 machine
  • your app doesn't have permission to do something (like read from HKLM) and doesn't handle that

Getting the actual error/exception message would be much more helpful to figure out why the app is crashing.

Try adding a catch-all exception handler which could pop-up an alert box with the exception text/stack trace or installing windbg as the interactive debugger and capturing a dump or running the app under the debugger.

nick