Package Reference
Every MSBuild property, item and target defined by the Babel.Obfuscator package, and the mapping between the package properties and the attributes of the Babel task.
Package Properties
The properties below control the package itself. Obfuscation settings are listed in the Property Mapping table.
| Property | Default | Description |
|---|---|---|
BabelEnabled | true | Master switch. When false, no Babel target runs, publish adjustments included. |
BabelPublishEnabled | $(BabelEnabled) | Whether merged and embedded assemblies are removed from the publish set. |
BabelUpdateDependencyFile | $(BabelEnabled) | Whether the build and publish .deps.json files are updated after obfuscation. |
BabelOverrideCompile | true | Whether the package injects the obfuscation step after CoreCompile. Set to false to wire the ObfuscateBuild target yourself. |
RunBabelAfterBuild | false | When true, Babel runs at the end of the build on $(TargetPath) instead of on the intermediate assembly. |
BabelBeforeTargets | Runs the obfuscation step before the named target, disabling the default placement. | |
BabelAfterTargets | Runs the obfuscation step after the named target, disabling the default placement. | |
BabelPackageDir | package root | Root folder of the extracted package. |
BabelTaskDir | per host | Folder the Babel task and tools are loaded from; see Selecting the Build Tools. |
BabelPath | $(BabelTaskDir) | Folder of the Babel executable to run (task attribute ToolPath). |
BabelExe | Name of the Babel executable, babel.exe or babel.dll (task attribute ToolExe). | |
BabelInputFile | intermediate assembly | Assembly to obfuscate. Computed by the package; override it in a settings target. |
BabelOutputFile | $(BabelInputFile) | Obfuscated output. Computed by the package; override it in a settings target. |
BabelLicense | babel.licenses found in the project folder or a parent folder | License file path, license key or floating: user key. |
BabelLicenseDir | Folder where babel.licenses was found, set by the package. | |
SymbolsRenaming | true | Enables or disables every renaming feature at once. |
NoConfiguration | true | Whether Babel ignores its configuration file. |
GenerateDebug | true when a PDB exists | Whether debug symbols are generated for the obfuscated assembly. |
CopyOutputSymbolsToPublishDirectory | false in Release | Standard SDK property; the package turns it off in Release so PDB files are not published. |
BabelProvideCommandLineArgs | false | Writes the Babel command line to the log and to the @(BabelCommandLineArgs) item. |
BabelWarningsAsErrors | Warning codes to report as errors. Set it to W00000 to fail builds that run in evaluation mode. | |
BabelWarningsAsInfos | Warning codes to report as informational messages. | |
BabelWarningsToIgnore | Warning codes to suppress. | |
BabelExitCode | Output: exit code of the Babel task, available after CoreObfuscate. |
Package Items
| Item | Description |
|---|---|
BabelRules | XML rules files. babelRules.xml in the project folder is added automatically. |
MergeAssembly | Assemblies to merge into the target assembly. |
EmbedAssembly | Assemblies to embed in the target assembly. |
MapInFile | XML map files of already obfuscated assemblies. |
BabelPlugin | Plugin assemblies to load. |
BabelSearchDirectories | Assembly search directories. Computed from the project references; replace or extend it in a settings target. |
BabelTargetReferences | Additional search entries passed as references. |
AddReferences | Assemblies to add as references of the obfuscated assembly. |
SatelliteAssembly | Satellite assemblies to process. |
XmlDocumentationFile | XML documentation files to process together with the assembly. |
BabelCommandLineArgs | Output: the command line passed to Babel, when BabelProvideCommandLineArgs is true. |
Targets
| Target | Description |
|---|---|
ObfuscateBuild | The obfuscation step injected into the build. Runs ObfuscateSettings then Obfuscate. |
ObfuscateSettings | Prepares the Babel task configuration by running the settings targets below. |
ObfuscateDefaultSettings | Applies the renaming defaults, looks up the license file, adds babelRules.xml and builds the search directories. |
ObfuscateFrameworkSettings | Selects the assembly to process: the intermediate assembly, or $(TargetPath) when RunBabelAfterBuild is true. |
ObfuscateSetupBabelFiles | Sets BabelInputFile and BabelOutputFile, and enables GenerateDebug when a PDB exists. |
ObfuscateCustomSettings, SetupObfuscate, ConfigureBabel | Empty targets, redefine them to adjust the computed configuration before Babel runs. |
Obfuscate | Runs BeforeObfuscate, CoreObfuscate and AfterObfuscate. |
BeforeObfuscate | Empty target, redefine it to run tasks just before the Babel task. |
CoreObfuscate | Runs the Babel task. Do not redefine it. |
AfterObfuscate | Empty target, redefine it to run tasks just after the Babel task. |
UpdateBabelBuildDependencyFile | After GenerateBuildDependencyFile: removes merged and embedded assemblies and the package from the build .deps.json. |
UpdateBabelPublishDependencyFile | After GeneratePublishDependencyFile: the same for the publish .deps.json. |
UpdateBabelFilesToPublish | After ComputeFilesToPublish: removes merged and embedded assemblies from the publish set. |
OverrideCompileWithBabel | After PrepareForBuild: inserts ObfuscateBuild after CoreCompile, unless the step has been moved or the build is a design-time build. |
EnableObfuscationFlag | Triggered by compilation: enables ObfuscateBuild only when the compiler actually ran. |
Property Mapping
The table maps every attribute of the Babel task to the MSBuild property or item the package reads. Properties accept the same values as the corresponding command line switch. Attributes marked 12.0 were added in version 12.
| Babel task attribute | Kind | Package property or item |
|---|---|---|
AddReferences | Item | @(AddReferences) |
AndroidSigningKeyAlias | Property | AndroidSigningKeyAlias |
AndroidSigningKeyPass | Property | AndroidSigningKeyPass |
AndroidSigningKeyStore | Property | AndroidSigningKeyStore |
AndroidSigningStorePass | Property | AndroidSigningStorePass |
BabelDirectory | Property | BabelDirectory |
CleanAttributes | Property | CleanAttributes |
ConstRemoval | Property | ConstRemoval |
ControlFlowIterations | Property | ControlFlowIterations (ILIterations is accepted as an alias) |
ControlFlowObfuscation | Property | ControlFlowObfuscation |
CopyAttributes | Property | MergeCopyAttributes |
DbgHelpDllDir | Property | DbgHelpDllDir |
DeadCodeElimination | Property | DeadCodeElimination |
DebuggingProtection | Property | DebuggingProtection |
DependenciesManifest | Property | DependenciesManifest |
DetectIfObfuscated | Property | DetectIfObfuscated |
DisgregateRemoval | Property | DisgregateRemoval |
DynamicProxy | Property | DynamicProxy |
DynamicProxyCallFilters | Property | DynamicProxyCallFilters |
EmbedAssemblies | Item | @(EmbedAssembly) |
EmitInvalidOpcodes | Property | EmitInvalidOpcodes |
EnableObfuscationAgent | Property | EnableObfuscationAgent |
EnumRemoval | Property | EnumRemoval |
FlattenNamespaces | Property | FlattenNamespaces |
Framework | Property | Framework |
GenerateDebug | Property | GenerateDebug |
GenerateLogFile | Property | GenerateLogFile |
GenerateMapOutFile | Property | GenerateMapOutFile |
InlineExpansion | Property | InlineExpansion |
InputFile | Property | BabelInputFile |
Instrument | Property | BabelInstrument |
InstrumentEmptyMethods | Property | InstrumentEmptyMethods |
Internalize | Property | MergeInternalize |
KeyContainer | Property | KeyContainerName |
KeyFile | Property | KeyOriginatorFile |
KeyPwd | Property | SigningCertPassword |
License | Property | BabelLicense |
LogFile | Property | BabelLogFile |
MakeProject | Property | MakeBabelProjectFile |
MapInFiles | Item | @(MapInFile) |
MapOutFile | Property | BabelMapOutFile |
MergeAssemblies | Item | @(MergeAssembly) |
ModuleInitializer | Property | ModuleInitializer |
ModuleInitializerTarget | Property | ModuleInitializerTarget |
ModuleVersionId | Property | ModuleVersionId |
MsilEncryption | Property | MsilEncryption |
NameLength | Property | NameLength |
NamePrefix | Property | NamePrefix |
NoConfiguration | Property | NoConfiguration |
NoWarnings | Property | BabelWarningsToIgnore |
ObfuscateEvents | Property | ObfuscateEvents |
ObfuscateFields | Property | ObfuscateFields |
ObfuscateMethods | Property | ObfuscateMethods |
ObfuscateParameters | Property | ObfuscateParameters |
ObfuscateProperties | Property | ObfuscateProperties |
ObfuscateTypes | Property | ObfuscateTypes |
ObfuscateXaml | Property | ObfuscateXaml |
OutputFile | Property | BabelOutputFile |
OverloadedRenaming | Property | OverloadedRenaming |
PdbFile | Property | PdbFile |
PdbPwd | Property | PdbPwd |
Plugins | Item | @(BabelPlugin) |
PluginsArguments | Property | PluginsArguments |
ProvideCommandLineArgs | Property | BabelProvideCommandLineArgs |
RandomSeed | Property | RandomSeed |
References | Item | @(BabelTargetReferences) |
RemoveFiles | Property | BabelRemoveFiles |
ResourceEncryption | Property | ResourceEncryption |
RulesFiles | Item | @(BabelRules) |
SatelliteAssemblies | Item | @(SatelliteAssembly) |
SealClasses | Property | SealClasses |
SearchDirectories | Item | @(BabelSearchDirectories) |
SearchSatelliteAssemblies | Property | SearchSatelliteAssemblies |
ShowLogo | Property | ShowLogo |
ShowStatistics | Property | ShowStatistics |
SingleFile | Property | PublishSingleFile (standard SDK property) |
SkipFiles | Property | BabelSkipFiles |
StatisticsFile | Property | StatisticsFile |
StringEncryption | Property | StringEncryption |
SuppressIldasm | Property | SuppressIldasm |
SuppressReflection | Property | SuppressReflection |
TakeFiles | Property | BabelTakeFiles |
TamperingDetection | Property | TamperingDetection |
TargetAssemblyName | Property | TargetAssemblyName |
ToolExe | Property | BabelExe |
ToolPath | Property | BabelPath |
Trace | Property | Trace |
TrustedBundle 12.0 | Property | TrustedBundle |
TrustedSigner 12.0 | Property | TrustedSigner (several fingerprints separated by ;) |
TrustedTeam 12.0 | Property | TrustedTeam |
UnicodeNormalization | Property | UnicodeNormalization |
Use | Property | Use |
ValueEncryption | Property | ValueEncryption |
VerboseLevel | Property | VerboseLevel |
VirtualFunctions | Property | VirtualFunctions |
WarningsAsErrors | Property | BabelWarningsAsErrors |
WarningsAsInfos | Property | BabelWarningsAsInfos |
XapCompressionLevel | Property | XapCompressionLevel |
XmlDocFiles | Item | @(XmlDocumentationFile) |
XmlRules | Property | XmlRules |
Setting the String Encryption Algorithm
The StringEncryption package property enables string encryption and selects the algorithm, exactly like the --stringencryption command-line switch. Accepted values are xor, hash, stream and custom (see String Encryption for a description of each). A boolean true enables string encryption with the default algorithm, while an algorithm name both enables it and selects that algorithm.
For example, to encrypt strings with the STREAM algorithm (authenticated per-string encryption, fully managed, AOT/trim/FIPS-safe, and supported from .NET Framework through .NET 10 including Android/iOS/MAUI), add to your project file:
<PropertyGroup>
<StringEncryption>stream</StringEncryption>
</PropertyGroup>The STREAM algorithm Ultimate is not included in lower editions: with those, stream falls back to the default algorithm.
On .NET Android / iOS / MAUI projects, run the obfuscation as a string-encryption-only pass so that type and member names stay intact for the platform interop layer.