Skip to main content
Version: 2024.2

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 configures the compatibility version during integration with the project. Depending on the integration type, Eazfuscator.NET uses one of two ways to specify the compatibility version:

Compatibility version in the post-build event integration

In the case of the post-build event, the value is set via -v command-line option:

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

Compatibility version in the MSBuild-level integration

In the case of the MSBuild-level integration, the value is set via EazfuscatorCompatibilityVersion property:

<PropertyGroup>1
<EazfuscatorIntegration>MSBuild</EazfuscatorIntegration>
<EazfuscatorActiveConfiguration>Release</EazfuscatorActiveConfiguration>
<EazfuscatorCompatibilityVersion>2023.3</EazfuscatorCompatibilityVersion>2
</PropertyGroup>

1

A group of pre-populated Eazfuscator.NET MSBuild properties configure the obfuscation integration.

2

Configures the compatibility version used by Eazfuscator.NET.

Note

When using Eazfuscator.NET as a NuGet package, MSBuild configuration properties are not present in a MSBuild project file by default. They should be added manually if needed.

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.

Note

To learn how to change your project's compatibility version, please refer to the corresponding knowledge base article.

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 a specific Eazfuscator.NET version from a shell 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 --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 "$(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.