网站首页 > 资源文章 正文
Dotfuscator是一款.NET混淆器和压缩器,防止你的应用程序被反编译。
保护你的应用
保护整个应用程序就像在应用程序的Visual Studio项目文件中添加几行代码一样简单(例如,MyExecutable.csproj)。集成后, Dotfuscator Professional将自动保护您的所有程序集 - 无论是来自应用程序的项目还是解决方案中的其他项目。 每次的版本发布也会自动保护。
本次《Dotfuscator教程:保护你的应用》包括以下内容:
- 集成到Visual Studio项目中
- 检查受保护的程序集
- 存档报告文件
- 加强保护
- 替代方法
本篇文章主要介绍如何将Dotfuscator集成到Visual Studio项目中。
集成到Visual Studio项目中
要将Dotfuscator集成到项目中,请在Visual Studio中编辑项目文件(.csproj)并进行如下所示的更改。
.NET Framework
要保护.NET Framework项目,请复制下面显示的新XML元素(<PropertyGroup>等),并在结束标签</Project>之前将它们粘贴到项目文件中。请注意,元素的顺序很重要。
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <!-- ...existing tags... --> <!-- Set build properties for Dotfuscator --> <PropertyGroup> <!-- Generate a default Dotfuscator config file (DotfuscatorConfig.xml) --> <!-- TODO: Set this to false after the file is generated by the first local build --> <DotfuscatorGenerateConfigFileIfMissing>true</DotfuscatorGenerateConfigFileIfMissing> <!-- Enable Dotfuscator for Release builds --> <DotfuscatorEnabled Condition="'$(Configuration)' == 'Release'">true</DotfuscatorEnabled> </PropertyGroup> <!-- Import the Dotfuscator MSBuild targets last --> <Import Project="$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\PreEmptive.Dotfuscator.Common.targets"/> </Project>
.NET Core or .NET Standard
要保护.NET Core或.NET Standard项目,请首先从项目的根<Project>标记中删除Sdk属性。然后,将下面显示的新元素复制到项目文件中的相应位置。
<Project> <!-- ORIGINALLY WAS: <Project Sdk="Microsoft.NET.Sdk"> The Sdk attribute has been replaced with explicit <Import> tags to ensure Dotfuscator's targets are imported after "Sdk.targets" --> <!-- Import SDK properties --> <!-- (before any existing tags) --> <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> <!-- ...existing tags... --> <!-- Import SDK targets --> <!-- (after any existing tags but before Dotfuscator targets) --> <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> <!-- Set build properties for Dotfuscator --> <PropertyGroup> <!-- Generate a default Dotfuscator config file (DotfuscatorConfig.xml) --> <!-- TODO: Set this to false after the file is generated by the first local build --> <DotfuscatorGenerateConfigFileIfMissing>true</DotfuscatorGenerateConfigFileIfMissing> <!-- Enable Dotfuscator for Release builds --> <DotfuscatorEnabled Condition="'$(Configuration)' == 'Release'">true</DotfuscatorEnabled> </PropertyGroup> <!-- Import the Dotfuscator MSBuild targets last --> <Import Project="$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\PreEmptive.Dotfuscator.Common.targets"/> </Project>
Xamarin
Dotfuscator与Xamarin应用程序集成是Xamarin构建过程的一部分,可使用与其他.NET平台相同的方法。但是,在开始之前,你应该了解Xamarin集成的一些特别的方面。
要保护你的Xamarin应用程序,你必须将Dotfuscator集成到每个输出项目(Android,iOS和UWP)中。Dotfuscator将保护项目输出目录中源自项目解决方案的所有程序集。
为了保护Xamarin项目(我们建议从Android开始),请在结束标记</Project>之前将下面显示的新元素复制到项目文件中的相应位置。
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <!-- ...existing tags... --> <!-- Set build properties for Dotfuscator --> <PropertyGroup> <!-- Generate a default Dotfuscator config file (DotfuscatorConfig.xml) --> <!-- TODO: Set this to false after the file is generated by the first local build --> <DotfuscatorGenerateConfigFileIfMissing>true</DotfuscatorGenerateConfigFileIfMissing> <!-- Enable Dotfuscator for Release --> <DotfuscatorEnabled Condition="'$(Configuration)' == 'Release'">true</DotfuscatorEnabled> <!-- Enable Dotfuscator for Ad-Hoc (only needed for iOS) --> <DotfuscatorEnabled Condition="'$(Configuration)' == 'Ad-Hoc'">true</DotfuscatorEnabled> <!-- Enable Dotfuscator for AppStore (only needed for iOS) --> <DotfuscatorEnabled Condition="'$(Configuration)' == 'AppStore'">true</DotfuscatorEnabled> <!-- Only needed when using Tamper Checks for Android --> <!-- TODO: If using Tamper Checks for Android, set this to the SHA-1 fingerprint of the certificate used to sign the app --> <DotfuscatorAndroidSigningCertFingerprint></DotfuscatorAndroidSigningCertFingerprint> </PropertyGroup> <!-- Import the Dotfuscator MSBuild targets last --> <Import Project="$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\PreEmptive.Dotfuscator.Common.targets"/> </Project>
Unity
将Dotfuscator集成到Unity项目中需要特殊配置,本次教程不包含这些配置。后续会整理的。
建立项目
在Visual Studio中,将更改保存到项目文件,关闭选项卡,然后重新加载项目。要获得受保护的应用程序,请按照正常情况在发布配置中构建项目。
作为初始构建的一部分,Dotfuscator将生成一个配置文件,DotfuscatorConfig.xml,它具有默认保护设置。构建将发出警告(见上面的屏幕截图),在第一次构建中你可以忽略。将生成的文件加入版本控制。
然后,构建将调用Dotfuscator来保护项目输出目录中的解决方案程序集(.exe和.dll文件)(例如,bin\Release)。Dotfuscator还将在新的DotfuscatorReports目录中生成报告文件;你应该从版本控制中排除此目录。
一旦构建完成,您的应用程序现在就受Dotfuscator保护了。
禁用配置文件生成
在第一次构建期间,Dotfuscator生成了一个具有默认保护设置的配置文件DotfuscatorConfig.xml。此功能在设置时很有用,但是一旦文件存在(并由版本控制跟踪),你应该禁用此功能,因为它可以屏蔽某种构建错误。
要禁用配置文件生成,请再次编辑项目文件(.csproj)并替换以下行:
将
<!-- Generate a default Dotfuscator config file (DotfuscatorConfig.xml) --> <!-- TODO: Set this to false after this file is generated by the first local build --> <DotfuscatorGenerateConfigFileIfMissing>true</DotfuscatorGenerateConfigFileIfMissing>
替换为
<!-- Error if the Dotfuscator config file (DotfuscatorConfig.xml) is missing --> <DotfuscatorGenerateConfigFileIfMissing>false</DotfuscatorGenerateConfigFileIfMissing>
点击“了解更多”下载产品最新版
↓↓↓
猜你喜欢
- 2024-10-17 取代 Python 多进程!伯克利开源分布式框架 Ray
- 2024-10-17 如何用2 KB代码实现3D赛车游戏?2kPlus Jam大赛了解一下
- 2024-10-17 穿得如Rihanna霸气,被催婚的时候能多一点底气?
- 2024-10-17 全新反作弊系统测试 外挂将无法影响游戏
- 2024-10-17 科林及玛格丽特创建无名氏DNA项目帮助确认了50多名被害人的身份
- 2024-10-17 脑叶公司玩家们所不知道的小技巧(脑叶公司 技巧)
- 2024-10-17 第二代NumPy?阿里开源超大规模矩阵计算框架Mars
- 2024-10-17 C语言之趣味main函数的参数讲解实验
- 2024-10-17 艺术家们用iPadpro和苹果铅笔重新构思棒球卡
- 2024-10-17 森海塞尔TCC M天花阵列麦克风荣获2024红点奖杰出产品设计奖
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 电脑显示器花屏 (79)
- 403 forbidden (65)
- linux怎么查看系统版本 (54)
- 补码运算 (63)
- 缓存服务器 (61)
- 定时重启 (59)
- plsql developer (73)
- 对话框打开时命令无法执行 (61)
- excel数据透视表 (72)
- oracle认证 (56)
- 网页不能复制 (84)
- photoshop外挂滤镜 (58)
- 网页无法复制粘贴 (55)
- vmware workstation 7 1 3 (78)
- jdk 64位下载 (65)
- phpstudy 2013 (66)
- 卡通形象生成 (55)
- psd模板免费下载 (67)
- shift (58)
- localhost打不开 (58)
- 检测代理服务器设置 (55)
- frequency (66)
- indesign教程 (55)
- 运行命令大全 (61)
- ping exe (64)
本文暂时没有评论,来添加一个吧(●'◡'●)