Configuring Eazfuscator.NET with a Standalone Configuration File
Article ID: KB100043Published: September 11, 2023
Synopsis​
There are situations when you need to obfuscate a pre-built .NET assembly or use a specific obfuscation configuration that is not a part of the compiled assembly.
Eazfuscator.NET supports a standalone configuration file option that may be helpful in both scenarios.
The configuration is performed in a familiar declarative fashion using System.Reflection.ObfuscateAssemblyAttribute
and System.Reflection.ObfuscationAttribute
custom attributes.
--configuration-file
command-line option of Eazfuscator.NET allows you to specify a path to the standalone obfuscation configuration file.
Instructions​
Please follow the instructions below to tune the settings of your .NET project so that Eazfuscator.NET is configured with --configuration-file
command-line option.
Instructions depend on a way Eazfuscator.NET is integrated with the project:
- SDK-style MSBuild Project
- MSBuild 2003 Project
- Command Line
Locate the project of interest in Solution Explorer window of Microsoft Visual Studio:
Add a new
ObfuscationSettings.cs
(or.vb
) file to your project:Invoke the context menu of
ObfuscationSettings.cs
file by clicking Right mouse button on the selected fileFind Properties menu item and click on it. In the Properties window, change the value of Build Action property to None:
Select the project in the Solution Explorer and double click on it:
The corresponding
.csproj
file will be opened in a text editor. Add the following Eazfuscator.NET property to a property group of the project:<PropertyGroup>
…
<EazfuscatorExtraArgs>--configuration-file "$(ProjectDir)ObfuscationSettings.cs"</EazfuscatorExtraArgs>
…
</PropertyGroup>
Locate the project of interest in Solution Explorer window of Microsoft Visual Studio:
Add a new
ObfuscationSettings.cs
(or.vb
) file to your project:Invoke the context menu of
ObfuscationSettings.cs
file by clicking Right mouse button on the selected fileFind Properties menu item and click on it. In the Properties window, change the value of Build Action property to None:
Invoke the context menu of the project by clicking Right mouse button
Find Properties menu item and click on it. Project properties window will appear
In the window, find Build Events tab and select it
Locate the Eazfuscator.NET command in the Post-build event command line and add
--configuration-file=$(ProjectDir)ObfuscationSettings.cs
option as shown below (note the quotes):
Locate the shell script that invokes
eazfuscator.net
command:eazfuscator.net …
Add
--configuration-file
command-line option as shown below:eazfuscator.net … --configuration-file <file-path>
Applicability​
This article applies to:
- Eazfuscator.NET 4.2 or higher. Earlier versions do not support
--configuration-file
command-line option