7.2. Probing Paths
Probing paths is a set of places at the file system where Eazfuscator.NET can search for dependencies of input assembly. Eazfuscator.NET is smart enough to deduct these paths from installed assemblies and from project settings, however it might be necessary to define probing paths manually when some complex scenario is involved.
7.2.1. How to Define Probing Paths?​
There are two ways to define probing paths: by declarative obfuscation attributes or by command line option.
Way #1. Define probing paths by declarative obfuscation attributes (recommended)​
To define a probing path, you should apply an attribute to your assembly. In order to do that, you can use the instructions below.
Instructions on defining the probing path by declarative obfuscation attribute
-
Open obfuscatable project inside the IDE
-
Add new source file to the project and call it
ObfuscationSettings.cs
(for C#) orObfuscationSettings.vb
(for Visual Basic .NET). You may prefer to use another name instead ofObfuscationSettings.cs
orObfuscationSettings.vb
-
Fill
ObfuscationSettings.cs
with the following content (C#):using System;
using System.Reflection;
[assembly: Obfuscation(Feature = @"assembly probing path C:\Example\Lib")]For Visual Basic .NET, fill
ObfuscationSettings.vb
with the following content:Imports System
Imports System.Reflection
<Assembly: Obfuscation(Feature:="assembly probing path C:\Example\Lib")>NoteChange
C:\Example\Lib
with the directory name you want to be probed for assembly dependencies.TipIt is recommended to use relative directory paths with script variables:
[assembly: Obfuscation(Feature = @"assembly probing path $(InputDir)\Lib")]
TipIf you want to define several probing paths then just add several attributes:
[assembly: Obfuscation(Feature = @"assembly probing path C:\Example\Lib1")]
[assembly: Obfuscation(Feature = @"assembly probing path C:\Example\Lib2")]
…
Way #2. Define probing paths by a command-line option​
There is a command line option --probing-paths "C:\Example\Lib"
which can be specified to achieve this functionality. If you want to define several probing paths then please use semicolon as a list separator: --probing-paths "C:\Example\Lib1;C:\Example\Lib2"
.
Change C:\Example\Lib
with the directory name you want to be probed for assembly dependencies.
Do not put a trailing slash at the end of the path, otherwise the operating system will interpret it as an escape symbol.