为什么我能够调试我的程序集?

发布于 2024-09-17 22:52:30 字数 336 浏览 4 评论 0原文

我正在开发一个处理各种颜色转换的程序集。当我将程序集加载到新项目中进行测试时,如果程序集中恰好存在错误,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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

独闯女儿国 2024-09-24 22:52:30

发生这种情况是因为您在计算机上安装了 VS,并且您正在部署 PDB 文件 - 如果未安装 VS,您将不会看到此对话框。

另外:

  • 不要部署在 Debug 配置中构建的代码。其中包含有助于调试的附加信息。
  • 确保您不将 PDB 文件与可执行文件一起部署。与上面相同,运行代码不需要它们。

这些都会有所帮助,但是任何程序集都可以使用反射器轻松反编译,因此您可能还需要研究混淆器以阻止其他程序员轻松查看您的代码。

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.

っ左 2024-09-24 22:52:30

这里有一个 C# 混淆器列表: http://www.csharp411.com/net-obfuscators/

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

淡水深流 2024-09-24 22:52:30

您需要的是混淆您的二进制文件。

What you need is to obfuscate your binaries.

挽袖吟 2024-09-24 22:52:30

基本上,如果您希望代码安全并且不希望您的类暴露给其他人,那么您肯定需要对代码进行混淆。

要混淆代码,您可以使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文