• ArmDot Home
  • Documentation
  • Tutorial
  • API
  • Download
Show / Hide Table of Contents
  • Getting Started
  • Tutorial
  • MSBuild Obfuscation Task
  • Embedded Files
    • Embedded Files
    • Predefined Directories
  • Key Generators
    • Key Generator for PHP
    • Key Generator for C/C++
  • Command Line Tools
    • ArmDotConsole.exe
  • API
    • ArmDot.Api.Keys
      • LicenseKey
      • LicenseKeyDecoderError
      • LicenseKeyDecoderException
    • ArmDot.Client
      • Api
      • Api.Hardware
      • Api.LicenseKeyState
      • EmbedFileAttribute
      • HideStringsAttribute
      • IntegrityCheckingAttribute
      • ObfuscateControlFlowAttribute
      • ObfuscateNamesAttribute
      • ObfuscateNamespacesAttribute
      • ProtectEmbeddedResourcesAttribute
      • VirtualizeCodeAttribute
    • ArmDot.Engine.MSBuildTasks
      • ObfuscateTask
  • Obfuscation Attributes
  • Stack Trace Deobfuscation
  • ArmDot Warnings
    • How to disable a warning?
    • Warning ARMDOT0001
    • Warning ARMDOT0002
    • Warning ARMDOT0003
    • Warning ARMDOT0004
    • Warning ARMDOT0005
    • Warning ARMDOT0006
    • Warning ARMDOT0007
    • Warning ARMDOT0008
  • Glossary
    • Hardware Id
  • License
  • Activation

MSBuild Obfuscation Task

It is quite easy to integrate obfuscation to a build process with the help of the MSBuild obfuscation task, that is implemented by the NuGet package: https://www.nuget.org/packages/ArmDot.Engine.MSBuildTasks/

🛈 Task Parameters

You can find description of all available parameters of the task here.

After adding the MSBuild obfuscation task to a project, you are to modify the project file to activate the task:

<Target Name="Protect" AfterTargets="AfterCompile" BeforeTargets="BeforePublish">
  <ItemGroup>
     <Assemblies Include="$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)" />
  </ItemGroup>
  <ArmDot.Engine.MSBuildTasks.ObfuscateTask
    Inputs="@(Assemblies)"
    ReferencePaths="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')"
    SkipAlreadyObfuscatedAssemblies="true"
  />
</Target>

Often a release build is the only one to be obfuscated. To enable obfuscation for the release build only, use MSBuild condition:

<Target Name="Protect" AfterTargets="AfterCompile" BeforeTargets="BeforePublish"
  Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  <ItemGroup>
     <Assemblies Include="$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)" />
  </ItemGroup>
  <ArmDot.Engine.MSBuildTasks.ObfuscateTask
    Inputs="@(Assemblies)"
    ReferencePaths="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')"
    SkipAlreadyObfuscatedAssemblies="true"
  />
</Target>
Back to top Armdot Home | Copyright © Softanics | Generated by DocFX