Dotfuscator Professional integrates with Xamarin projects through MSBuild. After you integrate Dotfuscator into a Xamarin project, Dotfuscator runs automatically when you build the project in Visual Studio, MSBuild, or another build system that supports Xamarin.
Dotfuscator uses the same build integration approach for Xamarin as other .NET platforms. However, Xamarin apps can include multiple platform-specific output projects, so you may need platform-specific protection settings for each target.
Supported Xamarin Project Types
Dotfuscator Professional supports Xamarin projects that produce apps for the following platforms:
- Android
- iOS
- Universal Windows Platform (UWP)
If you are developing a cross-platform Xamarin app, such as a Xamarin.Forms app, integrate Dotfuscator into the app project for each platform you want to protect.
For example, if your app targets Android and iOS, integrate Dotfuscator into both platform output projects.
This approach allows stronger protection and lets you configure platform-specific settings when needed. For example:
- Android apps may use Root Checks or Tamper Checks.
- iOS apps may require platform-specific Renaming exclusions.
- Different output projects may require different build configurations or protection settings.
Choose Which Projects to Protect
Integrate Dotfuscator only into output projects that produce mobile app packages, such as an Android project that produces an APK.
When Dotfuscator protects an output project, it also protects assemblies packaged as part of that project. You do not need to integrate Dotfuscator into library projects, such as .NET Standard libraries or Portable Class Libraries, if those libraries are packaged by the output project.
Choose Which Configurations to Protect
For each Xamarin output project that you integrate with Dotfuscator, decide which build configurations should run protection.
The default configuration protects common release-oriented configurations, such as:
- Release
- Ad-Hoc
- AppStore
The Ad-Hoc and AppStore configurations apply only to iOS projects.
You can use different protection settings for each platform when your Xamarin app needs platform-specific behavior.
For more information, see Configure Dotfuscator Build Integration.
Supported Build Environments
Dotfuscator Professional’s Xamarin build integration runs on Windows and macOS build machines.
Cloud-based build services can also run Dotfuscator if their build agents use a supported operating system. Examples include:
- Azure DevOps Pipelines
- Visual Studio App Center
Dotfuscator must be installed and provisioned on each machine where the integrated Xamarin project is built.
If you build an iOS app on a Windows machine connected to a macOS machine over SSH, install Dotfuscator on the Windows machine.
For CI/CD environments, see Set Up Dotfuscator on Build Agents.
Configure Protection on macOS
If you build Xamarin apps on macOS, install Dotfuscator with the NuGet package.
After Dotfuscator is integrated into the project, customize protection by editing the Dotfuscator configuration file directly in a text editor.
If you prefer to use the Dotfuscator Config Editor, build and configure the project on Windows.
Integrate Dotfuscator into a Xamarin Project
To integrate Dotfuscator into a Xamarin project, follow the Xamarin instructions in Configure Dotfuscator Build Integration.
Start with one target platform, then repeat the process for each additional platform you want to protect.
Use Platform-Specific Configuration
Cross-platform Xamarin apps may need different protection settings for each target platform.
Use platform-specific configuration when:
- Android and iOS require different Check settings.
- A Renaming exclusion is needed only for one platform.
- A specific platform needs different input, output, or protection behavior.
- You need different protection settings for Release, Ad-Hoc, or AppStore builds.
For more information, see Configure Dotfuscator Build Integration.
Legacy Xamarin Targets File
Older Dotfuscator Xamarin integration instructions required a PreEmptive.Dotfuscator.Xamarin.targets file. Some external documentation and blog posts may still reference that file.
Current Dotfuscator Professional versions no longer require this file. As of Dotfuscator Professional v4.37, Xamarin integration uses the same simplified MSBuild integration approach as other supported .NET platforms.
Use the current Dotfuscator Professional instructions for your version:
- For Dotfuscator Professional, follow the instructions in this article and Configure Dotfuscator Build Integration.
- For Dotfuscator Community, review the latest Xamarin integration instructions in the Dotfuscator Community documentation.
Before You Release
Before releasing a protected Xamarin app:
- Build the app in the intended release configuration.
- Test each target platform that you plan to release.
- Test any configured Checks, such as Root Checks or Tamper Checks.
- Verify platform-specific Renaming exclusions.
- Confirm that signing and packaging complete successfully.
- Archive Dotfuscator report files for the release build.
- Review the Release Checklist.