tags:

views:

143

answers:

4

I am working on an assembly that handles various color transformations. When I load the assembly into a new project to test, if there happens to be an bug in the assembly, Visual Studio opens the offending code from the DLL. I can step through all of the code in the assembly.

I definitely don't want the code to be so easily visible/available. I would like the code to be somewhat "locked" in the assembly.

How can I set the DLL to simply throw some sort of error instead of opening?

Edit

I'm not interested in the code being "safe" and I have no need to obfuscate. This library is being used internally and the code itself is perfectly accessible to tohers. What I don't want is for someone using the library to find themselves suddenly debugging the assembly. If there is a problem, I prefer to have an error thrown instead of the assembly code opening in Visual Studio.

+15  A: 

This is happening because you have VS installed on the machine, and because you are deploying the PDB files - you will not get this dialogue box if VS is not installed.

Additionally:

  • Do not deploy code that has been built in the Debug configuration. These contain additional information that helps with debugging.
  • Make sure you do not deploy the PDB files with the executables. Same as above, and they are not needed for running the code.

Both these will help, but any assembly would be easily decompiled with reflector, so you may also want to investigate obfuscators to stop other programmers from easily seeing your code.

Oded
Thanks. I'll try this out now. I'm certainly not trying to obfuscate my code as I know that it can be easily decompiled. I am, however, trying to keep things clean and tidy for whoever is using the library and there is no need for anyone to pry open the DLL (unless that is their main intention.)
Marvin Aldrige
+2  A: 

What you need is to obfuscate your binaries.

Excel20
+3  A: 

There is a list of C# obfuscators here : http://www.csharp411.com/net-obfuscators/

Steve Townsend
A: 

Basically if you want your code to be safe and you dont want your classes are exposed to others, you should definitely need to Obfuscate your code.

To obfuscate your code you can use DotFuscator, it is included with Visual Studio installation.

check my article on it. http://www.codeproject.com/KB/dotnet/code_security.aspx

abhishek