Dotfuscator uses external tools and assembly load paths during the build process. These settings help Dotfuscator process assemblies and locate referenced assemblies.
Use this article when you need to understand how Dotfuscator finds ILdasm and ILasm, when .NET Framework SDK tools are required, how to specify tool locations explicitly, or how to add custom assembly load paths.
Finding External Tools
Dotfuscator uses the following tools to process assemblies:
| Tool | Description |
| ILdasm | The .NET intermediate language disassembler. |
| ILasm | The .NET intermediate language assembler. |
Dotfuscator can obtain these tools in two ways:
- From the .NET Framework tools installed on Windows.
- From NuGet packages that Dotfuscator retrieves automatically during the build process.
Normally, Dotfuscator selects the best tools for each assembly based on the assembly target framework.
Tools from .NET Framework
When Dotfuscator runs on Windows, ILdasm can be provided by an installed .NET Framework SDK, and ILasm can be provided by an installed .NET Framework runtime.
Dotfuscator locates these tools automatically when they are present.
These tools:
- Support certain additional features.
- Run only on Windows.
- Do not support assemblies targeting newer frameworks, such as .NET Core 3.x and .NET 5.
Tools from NuGet
Dotfuscator can use NuGet to obtain ILdasm and ILasm. Dotfuscator handles retrieval and use of these packages automatically as part of the build process.
Use the following environment variables if the default NuGet source is unavailable:
| Environment Variable | Description |
| DOT_ILTOOLS_CORE_NUGETFEED | Sets the NuGet source feed. |
| DOT_ILTOOLS_CORE_NUGET_USERNAME | Sets the username for the NuGet source feed. |
| DOT_ILTOOLS_CORE_NUGET_PASSWORD | Sets the password for the NuGet source feed. |
Tools from NuGet:
- Run on Windows, macOS, and Linux.
- Support assemblies targeting newer frameworks, such as .NET Core 3.x and .NET 5.
- Do not support certain additional features that require the Windows-exclusive .NET Framework SDK.
How Dotfuscator Chooses Tools
Dotfuscator uses the following process to find ILdasm and ILasm for each input assembly:
- Dotfuscator determines the metadata version of the assembly.
- In most cases, this is 4.0.30319.
- Assemblies targeting older versions of the Windows-only .NET Framework may have a lower metadata version.
- Dotfuscator checks whether user-specified properties exist for the metadata version.
- If matching properties are defined, Dotfuscator uses those tool paths.
- If Dotfuscator is running on macOS or Linux, Dotfuscator uses tools from NuGet.
- If the assembly targets a runtime that supports default interface methods, Dotfuscator uses tools from NuGet.
- If the assembly targets a Windows-exclusive runtime, Dotfuscator uses tools from .NET Framework.
- For other target frameworks, Dotfuscator uses tools from .NET Framework if they are present. If they are not present, Dotfuscator uses tools from NuGet.
Target Frameworks That Use NuGet Tools
Dotfuscator uses tools from NuGet for target frameworks that support default interface methods, including:
- .NET 5.0 and later
- .NET Core 3.0 and later
- .NET Standard 2.1
- Xamarin Android
- Xamarin iOS
- MAUI Android
Target Frameworks That Use .NET Framework Tools
Dotfuscator uses tools from .NET Framework for Windows-exclusive target frameworks, including:
- .NET Framework 4.x and earlier
- Universal Windows Platform (UWP)
Target Frameworks That Can Use Either Tool Set
For the following target frameworks, Dotfuscator uses .NET Framework tools if they are present. If they are not present, Dotfuscator uses tools from NuGet:
- .NET Core 2.x and earlier
- .NET Standard 2.0 and earlier
- Portable Class Libraries
Features Requiring .NET Framework SDK
Some features are available only when Dotfuscator uses the Windows-exclusive .NET Framework SDK tools.
| Feature | Requirement |
| Debugging symbols, such as .pdb files | Requires .NET Framework SDK tools. |
| Native Win32 resource files embedded in assemblies, such as Windows file versions or application icons | Requires .NET Framework SDK tools. |
| Managed resources, such as .resx files | Supported in all scenarios. |
The following table summarizes feature support by operating system and target app type.
| OS | Target App Type | Debugging Symbols | Native Resources | Managed Resources |
| Windows | .NET 5.0 and later | Not supported | Not supported | Supported |
| Windows | .NET Core 3.0 and later | Not supported | Not supported | Supported |
| Windows | .NET Core 2.x and earlier | Supported* | Supported* | Supported |
| Windows | .NET Framework 4.x and earlier | Supported | Supported | Supported |
| Windows | .NET Standard 2.1 | Not supported | Not supported | Supported |
| Windows | .NET Standard 2.0 and earlier | Supported* | Supported* | Supported |
| Windows | Portable Class Libraries | Supported* | Supported* | Supported |
| Windows | Xamarin Android | Not supported | Not supported | Supported |
| Windows | Xamarin iOS | Not supported | Not supported | Supported |
| Windows | Universal Windows Platform | Supported | Supported | Supported |
| Windows | MAUI Android | Not supported | Not supported | Supported |
| macOS | Any | Not supported | Not supported | Supported |
| Linux | Any | Not supported | Not supported | Supported |
* If you installed Dotfuscator with the NuGet package, a full Windows .NET Framework SDK must also be installed to use this feature.
Explicitly Specify Tool Locations
You can use properties to specify a specific ILdasm or ILasm executable for assemblies built on certain versions of .NET.
.NET Core and .NET Standard assemblies are always considered to be built on version 4.0, because that is the metadata version embedded in these assemblies.
| Property Name | Property Value | Meaning |
| ILDASM_v2.0.50215 | C:\1\ildasm.exe | Dotfuscator disassembles input assemblies that target .NET Framework v2.0.50215 with this version of ILdasm. |
| ILDASM_v1.1 | C:\2\ildasm.exe | Dotfuscator disassembles input assemblies that target .NET Framework v1.1.x with this version of ILdasm. |
| ILASM_v1.0.3705 | C:\3\ilasm.exe | Dotfuscator assembles output assemblies that target .NET Framework v1.0.3705 with this version of ILasm. |
| ILASM_v4.0 | C:\4\ilasm.exe | Dotfuscator assembles output assemblies that target .NET Framework v4.x, .NET Core, or .NET Standard with this version of ILasm. |
Dotfuscator determines the kind of user-supplied tool by checking the path. If the path contains Microsoft.NETCore, Dotfuscator treats the tool as coming from NuGet. Otherwise, Dotfuscator treats the tool as coming from .NET Framework.
User-Defined Assembly Load Paths
When Dotfuscator builds a config, it needs to load assemblies referenced by the input assemblies. Dotfuscator typically uses rules similar to other .NET tools when discovering these assemblies.
You can specify custom locations where Dotfuscator should look for referenced assemblies. This is useful when a config references third-party assemblies without including those assemblies in the config.
If Dotfuscator cannot find a referenced assembly using the default search rules, add the directory to the user-defined assembly load paths.
Configure Assembly Load Paths
To configure user-defined assembly load paths:
- Open your Dotfuscator config in the Config Editor.
- Go to Settings.
- Open the Assembly Load Paths tab.
- Select the add icon and specify the directory that Dotfuscator should search.
- Add all the assembly load paths required.
- If needed, change the order in which directories are searched with the up and down icons.
- If Dotfuscator should search the custom load path before its standard search, select Search First.
- Save the config.
When you select the Search First option, Dotfuscator searches the user-defined assembly load path before applying its standard search rules. When Search First is not selected, Dotfuscator searches the load path after applying its standard search rules.