2

I have created a custom user control and build it into a DLL file, When I use it into another project as a user control, after occurring an exception, it's source appears and everyone can change and build it again for himself.

how can I lock or close my custom user control's source code?

3
  • Can you explain how you can see the code source, when exception has occurred? Commented Jun 14, 2011 at 6:52
  • They can even watch the source without the exception: reflector.red-gate.com/download.aspx?TreatAsUpdate=1. You can do that because C# is not compiled to machine code but intermediate language Commented Jun 14, 2011 at 6:55
  • 1
    are you shipping the .pdb file with the .dll file? Commented Jun 14, 2011 at 7:09

1 Answer 1

1

I didn't understand from the question how throw exception reveals the source code.

However, there is not much you can do in order to completely hide your source code. As .NET assembly is contains IL code which can be always reverse-engineered quite easily with tools like Reflector.

The best thing you can do is to obfuscate the code. There are a bunch of different tools and obfuscation algorithm. Google for .NET obfuscator and you pick the tool you like more.

You can find quite a few obfuscators listed here : http://msdn.microsoft.com/en-us/vcsharp/aa336818.

Sign up to request clarification or add additional context in comments.

1 Comment

Note that obfuscation only makes the code harder to read in order to discourage the one that wants to read it. He can still figure it out eventually.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.