Babel Obfuscator
HomeDocumentationShop
  • Introduction
    • General Features
  • Getting Started
    • Install
    • Product Activation
  • Command Line
    • Command Line Reference
      • Miscellaneous
      • Input Files
      • Output Files
      • Plugins
      • Merge and Embed
      • Renaming
      • Control Flow Obfuscation
      • Encryption and Protection
      • Code Generation
  • MSBuild Task
    • Babel Task Reference
    • Customizing Intellisense
  • NuGet Package
    • NuGet Pakage Reference
  • User Interface
    • Obfuscation
    • Tools
    • Custom Themes
  • Obfuscation Rules
    • XML Rules
      • Example Rules
    • Custom Attributes
    • Obfuscation Agent
  • Merge and Embed
    • Assembly Merging
    • Assembly Embedding
  • Symbols Renaming
    • XML Map Files
    • Cross Assembly Renaming
    • XAML Renaming
    • Decoding Stack Traces
  • String Encryption
    • Custom String Encryption
  • Control Flow Obfuscation
  • Code Encryption
    • External Code Files
    • Password Protected Code
    • Dynamic Code
  • Dynamic Proxy
  • Resource Encryption
  • Value And Array Encryption
  • Tampering Detection
  • Anti Debugging
  • Enhancing Code Security
  • Optimizations
    • Dead Code Removal
    • Metadata Optimizations
    • Code Optimizations
  • Appendix
  • Examples
    • Examples
    • General Samples
      • ClickOnce Deploy
      • Detecting Babel Obfuscation
      • Obfuscate .NET MAUI
      • Blazor Web App
    • Code Encryption
      • Feature Based Licenses
    • Cross Assembly Renaming
      • Publish .NET App
    • Build Servers
      • GitHub Actions
      • Unit Tests
    • Babel Obfuscator NuGet
      • Android Application
  • Plugins
    • Babel Obfuscator Plugins
    • Encrypt Plugin
      • Getting Started
      • Source Code
Powered by GitBook
On this page
  • Embedding From Command Line
  • Embedding From MSBuild Babel Task
  • Embedding From Babel UI

Was this helpful?

  1. Merge and Embed

Assembly Embedding

Babel Obfuscator provides a feature to embed multiple assemblies into the main application, which can reduce the overall size of the deployed assembly. When embedding assemblies with Babel Obfuscator, the embedded assemblies are first encrypted and compressed before being stored as managed resources within the main application assembly.

It is important to note that embedded assemblies are not obfuscated. Therefore, it's recommended only to embed assemblies that do not contain proprietary code or components that are not meant to be protected.

Embedding From Command Line

To embed assemblies from the command line using the Babel tool, you can use the --embed option followed by the assembly file path to embed. You can enter the command multiple times to embed several assemblies.

babel MyApp.exe --embed Library1.dll --embed Library2.dll

This command will embed Library1.dll and Library2.dll into MyApp.exe. The embedded assemblies will be stored as managed resources within the main assembly.

You can also use an XML rules file to specify additional settings, such as compression or encryption. For example, create a file named embed.xml with the following contents:

<Rules>
  <Rule name="Library1" feature="embed" exclude="false">
    <Target>Assembly</Target>
    <Pattern>Library1.dll</Pattern>
    <Properties>
      <Compress>false</Compress>
    </Properties>
  </Rule>
  <Rule name="Library2" feature="embed" exclude="false">
    <Target>Assembly</Target>
    <Pattern>Library2.dll</Pattern>
    <Properties>
      <Encrypt>false</Encrypt>
    </Properties>
  </Rule>
</Rules>

Then run the following command to embed the assemblies based on the rules file:

babel MyApp.exe --embed Library1.dll --embed Library2.dll --rules embed.xml

Embedding From MSBuild Babel Task

To embed assemblies using the MSBuild Babel task, you need to add a new ItemGroup element in your project file. Inside the ItemGroup, you can define multiple EmbedAssembly items, each one specifying a path to an assembly file to embed. For example:

<ItemGroup>
   <EmbedAssembly Include="path/to/Assembly1.dll" />
   <EmbedAssembly Include="path/to/Assembly2.dll" />
</ItemGroup>

You can reference the EmbedAssembly in the Babel task using the EmbedAssemlies attribute:

<Babel EmbedAssemblies="@(EmbedAssembly)" RulesFiles="embed.xml" />

You can optionally specify a rule file to customize the compression and encryption settings for each embedded assembly. By default, embedded assemblies are compressed and encrypted using Babel's default settings, but a rule file can be used to customize these settings if necessary.

Embedding From Babel UI

To embed assemblies using Babel UI, you can follow these steps:

  1. Open the Babel Obfuscator user interface and create a new project or open an existing one.

  2. Click + icon located to the left of the row corresponding to the primary assembly. This will reveal the Input Grid, where you can add the list of assemblies to be embedded.

  3. In the Input Grid File column, Click ... to browse and select the assemblies you want to embed. Alternatively, you can drag and drop the list of assemblies in the Input Grid.

  4. Ensure the Action is set to Embed for every assembly added.

  5. You can configure the embedding options, such as encryption and compression, by creating rules in the Rules panel.

Last updated 2 years ago

Was this helpful?

BabelUI Assembly Embedding