Skip to main content
Version: 2023.1

7.9. Compatibility

Eazfuscator.NET constantly evolves from one version to another. That's why some provisions should be made to ensure the successful integration of Eazfuscator.NET with your project over the time. This chapter describes all aspects related to compatibility in long-term perspective.

7.9.1. Compatibility Version

Compatibility version option instructs Eazfuscator.NET to mimic its corresponding version from the past. Why it should be used? The answer is very straightforward: usually Eazfuscator.NET is integrated with a project just once; after that the user of Eazfuscator.NET expects that integration will continue to flawlessly work whatever future version of Eazfuscator.NET is installed.

Eazfuscator.NET automatically adds a compatibility version option -v to the obfuscation command line in the post-build event of a project:

Obfuscation command line with supplied compatibility version option in post-build event of a project

The value of compatibility version should be equal to the version of Eazfuscator.NET that was used during the project integration stage. This guarantees that the future versions of Eazfuscator.NET will mimic the integrated version, thus delivering a solid upgrade path.

When compatibility version is not specified or its value is top, Eazfuscator.NET assumes that compatibility version corresponds to the latest version of the product.

Important

If you manually invoke Eazfuscator.NET from command line or from custom script then please ensure that compatibility version is supplied with -v command line option.

7.9.2. Demanding the Specific Version of Eazfuscator.NET

Sometimes it may be useful to restrict the version of Eazfuscator.NET to work with. For example, some previous version of Eazfuscator.NET contained a bug which was later fixed, and some of your colleagues may still have that old version. It is not always possible to explicitly force the team members to upgrade Eazfuscator.NET to a newer version, that's why an ability to restrict the version of Eazfuscator.NET would be a good way to achieve this.

Please follow the instructions below to instruct Eazfuscator.NET to fail when its version is lower than required.

Instructions on forcing Eazfuscator.NET to fail when its version is lower than a given value

  1. Open obfuscatable project inside the IDE

  2. Add new source file to the project and call it ObfuscationSettings.cs (for C#) or ObfuscationSettings.vb (for Visual Basic .NET). You may prefer to use another name instead of ObfuscationSettings.cs or ObfuscationSettings.vb

  3. Fill ObfuscationSettings.cs with the following content (C#):

    using System;
    using System.Reflection;

    [assembly: Obfuscation(Feature = "require eazfuscator.net version >= X.Y")]

    For Visual Basic .NET, fill ObfuscationSettings.vb with the following content:

    Imports System
    Imports System.Reflection

    <Assembly: Obfuscation(Feature:="require eazfuscator.net version >= X.Y")>
Note

Change X.Y with Eazfuscator.NET version number.

Important

Support of this syntax appeared since Eazfuscator.NET 3.2. The syntax is ignored by previous versions of Eazfuscator.NET. If you have an absolute necessity to cover the previous versions too then please use the batch script approach shown in the section below.

Demanding the specific version from a batch script

Batch scripts usually reside in .bat or .cmd files, but can also be coded in post-build event of a project.

The following batch script can be used to demand a specific version of Eazfuscator.NET which is greater or equal to a given value X.Y:

if /I "$(ConfigurationName)" NEQ "Release" goto SkipObfuscation
Eazfuscator.NET.exe --check-version GEQ X.Y >NUL 2>NUL
if %ErrorLevel% NEQ 0 (
echo Eazfuscator.NET X.Y or higher is not installed on this machine. Obfuscation failed.
REM The line below resets error level to 0. Uncomment it if you want to force script to continue execution when no required version of Eazfuscator.NET is present
REM verify >NUL 2>NUL
) else (
Eazfuscator.NET.exe "$(TargetPath)" --msbuild-project-path "$(ProjectPath)" --msbuild-project-configuration "$(ConfigurationName)" --msbuild-project-platform "$(PlatformName)" --msbuild-solution-path "$(SolutionPath)" -n --newline-flush -v <compatibility_version>
)
:SkipObfuscation
Note

Change X.Y with Eazfuscator.NET version number.