I have a DLL put together which is used by a number of applications. They compile and run just fine on my development machine. But if I try to deploy them, I just get the standard "your application has crashed" message from Windows when I try to run them. I figured, since they're .NET, I could install Visual Studio and see what the exception is. But once I install Visual Studio, everything works fine! I've tried to identify anything (like certain versions of the .NET framework) that VS installs and try to replicate it, but still nothing will work till visual studio itself is installed. I certainly can't require people to install visual studio to use my app. What can I do?
-
1Could you post the exact error? Since it is a DLL, when exactly does it crash? On DLL load? What is loading the DLL? How is it being referenced? Does the executing PE (or dll?) have administrative privileges? – bdd Feb 03 '10 at 15:18
-
Are you sure the .net framework is installed on your test machine? Alternatively, make sure all dlls are included in the same folder as the application. – Cyclone Feb 03 '10 at 15:18
-
1can you work out what the dependencies are using Reflector? Then check that it isn't reliant on any Microsoft (i.e. non .NET framework) or VisualStudio assemblies. – Matt Breckon Feb 03 '10 at 15:19
-
Did you change the build type to release before you shipped it to the other computer? – Joel Etherton Feb 03 '10 at 15:21
6 Answers
If you reference the DLL from a console app, it should dump a stack trace to the console when it crashes... that may help.
Also, try enabling the Fusion log to help debug issues with finding references.
This is most likely a DLL that has a dependency on the C Runtime Library (CRT). You need to make sure to deploy the Release build of the DLL, the debug version of the CRT libraries cannot be distributed. If you compiled with the /MD option, you will also need to deploy the CRT DLLs to the target machine. Compiling with /MT avoids that but this option is not available if you use managed code in your DLL.

- 922,412
- 146
- 1,693
- 2,536
Add a try
/ catch
block to the program that displays or emails the exception.
Also, make sure that the correct version of .Net is installed.
Finally, go through your referenced DLLs and make sure that they all exist.

- 868,454
- 176
- 1,908
- 1,964
It sounds like you may not be delivering a required assembly during deployment. Use a tool like .Net Reflector to see.
The accepted answer on another question gives specific instructions.
In your deploy machine must install the Microsoft Visual C++ Redistributable Package

- 1,360
- 3
- 22
- 43