为什么我能够调试我的程序集?
我正在开发一个处理各种颜色转换的程序集。当我将程序集加载到新项目中进行测试时,如果程序集中恰好存在错误,Visual Studio 会从 DLL 中打开有问题的代码。我可以单步执行程序集中的所有代码。
我绝对不希望代码如此容易可见/可用。我希望代码在某种程度上“锁定”在程序集中。
如何将 DLL 设置为仅抛出某种错误而不是打开?
编辑
我对代码的“安全”不感兴趣,也不需要混淆。该库正在内部使用,代码本身可供其他人完全访问。我不希望使用该库的人发现自己突然在调试程序集。如果出现问题,我更喜欢抛出错误,而不是在 Visual Studio 中打开汇编代码。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
发生这种情况是因为您在计算机上安装了 VS,并且您正在部署 PDB 文件 - 如果未安装 VS,您将不会看到此对话框。
另外:
Debug
配置中构建的代码。其中包含有助于调试的附加信息。这些都会有所帮助,但是任何程序集都可以使用反射器轻松反编译,因此您可能还需要研究混淆器以阻止其他程序员轻松查看您的代码。
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:
Debug
configuration. These contain additional information that helps with debugging.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.
这里有一个 C# 混淆器列表: http://www.csharp411.com/net-obfuscators/
There is a list of C# obfuscators here : http://www.csharp411.com/net-obfuscators/
您需要的是混淆您的二进制文件。
What you need is to obfuscate your binaries.
基本上,如果您希望代码安全并且不希望您的类暴露给其他人,那么您肯定需要对代码进行混淆。
要混淆代码,您可以使用 DotFuscator,它包含在 Visual Studio 安装中。
检查我的文章。
http://www.codeproject.com/KB/dotnet/code_security.aspx
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