在Visual Studio 2015中使用confuserEx对代码进行混淆

时间:2018-09-28 07:07:35

标签: wpf visual-studio obfuscation

我正在混淆我的项目。下面介绍了我遵循的步骤

步骤1:我在项目中添加了Confuser.crproj文件

<project outputDir="{OutputDir}" baseDir="{BaseDir}" 
    xmlns="http://confuser.codeplex.com">
      <rule pattern="true" preset="aggressive" />
      <module path="{TargetFileName}">
        <rule pattern="true" preset="aggressive" />
      </module>
      <probePath>{ProbePath1}</probePath>
      <probePath>{ProbePath2}</probePath>
    </project>

以上代码写在crproj文件中。  第2步;创建了一个powershell脚本文件confuserps.ps1。

param (
[string]$OutputDir,
[string]$BaseDir,
[string]$TargetFileName,
[string]$ConfuserConfigurationFile,
[string]$ProbePath1,
[string]$ProbePath2
)
function replace-file-content([string] $path, [string] $replace, [string] 
$replaceWith)
{
(Get-Content $path) |
Foreach-Object {$_ -replace $replace,$replaceWith}|
Out-File $path
}
//Let's first copy the configuration file to a temporary directory
echo "Obfuscating..."
$tempFile = [string]::Concat($BaseDir, "confuser.temp.crproj")
echo "Copying " $ConfuserConfigurationFile " to " $tempFile
Copy-Item $ConfuserConfigurationFile -Destination $tempFile
echo "Replacing placeholders..."
replace-file-content $tempFile "{OutputDir}" "$OutputDir"
replace-file-content $tempFile "{BaseDir}" "$BaseDir"
replace-file-content $tempFile "{TargetFileName}" "$TargetFileName"
replace-file-content $tempFile "{ProbePath1}" "$ProbePath1"
replace-file-content $tempFile "{ProbePath2}" "$ProbePath2"
echo "Performing Obfuscation..."
start-process -wait "F:ToolsObfuscatorsConfuserEx_binConfuser.CLI.exe" 
"$tempFile"
echo "Obfuscation complete."
echo "Removing " $tempFile
Remove-Item $tempFile
echo "Done!!!"

步骤3:在项目的构建后命令中添加了以下脚本

if "$(ConfigurationName)" == "Release" (powershell.exe -File  &"C:\September\confuserps.ps1" &" $(TargetDir)" &"$(TargetDir)" &"$(TargetPath)" &"$(ProjectDir)confuser.crproj" &"$(SolutionDir)BaseProjectbin" &"$(SolutionDir)BaseProject2bin)"

我收到错误代码255。我无法混淆任何帮助。

0 个答案:

没有答案