Protecting Xamarin Apps
You can integrate Dotfuscator Professional into your Xamarin projects. Once integrated into a project, Dotfuscator will automatically protect the project whenever you build it in Visual Studio, MSBuild, or another build system which supports Xamarin. Integrating Dotfuscator in this way creates an app with a proven, layered protection strategy, no matter what device it's running on.
Dotfuscator Professional's build integration for Xamarin uses the same approach used by other .NET platforms. However, there are some unique aspects to the Xamarin integration that you should understand before you begin.
Supported Project Types
You can integrate Dotfuscator Professional into Xamarin projects that produce apps for the following platforms:
- Android
- iOS
- Universal Windows Platform (UWP)
If you are developing a cross-platform Xamarin app (for example, with Xamarin.Forms), you will need to integrate Dotfuscator into the app project for each platform you want to support. This allows for stronger protection. Additionally, Dotfuscator sometimes needs to have unique configuration settings for each platform (e.g. Root Checks and Tamper Checks on Android, or a renaming exclusion that is only necessary on iOS).
Dotfuscator only needs to be integrated into output projects that produce mobile app packages, such as an Android project that produces an APK. When Dotfuscator protects these output projects, it will also automatically protect all 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 (PCLs), that are used by the output projects, because those libraries are automatically protected when packaged. For more information, see Choosing Which Projects to Protect.
For each output project you integrate Dotfuscator into, you also need to decide what build configurations you want the protection applied to. The default configuration provided in the instructions will protect Release, Ad-Hoc, and AppStore configurations. The Ad-Hoc and AppStore configurations are only used by iOS projects. For more information, see Choosing Which Configurations to Protect.
Supported Build Environments
Dotfuscator Professional's build integration can run as part of builds on both Windows and macOS build machines. Cloud-based build services can also support Dotfuscator if they use these operating systems for their build agents. Examples include Azure DevOps Pipelines and Visual Studio App Center.
Dotfuscator must be installed and provisioned on each machine where the integrated project is built. (When building an iOS app using a Windows machine connected to a macOS machine over SSH, install Dotfuscator on the Windows machine.) For details, see Build Agents.
Integration Instructions
To get started, follow the instructions on the Protect Your App page for one of your target platforms. Then repeat that process for each additional platform you wish to protect.
What happened to the 'PreEmptive.Dotfuscator.Xamarin.targets' file?
Dotfuscator's Xamarin integration has improved dramatically since it was first introduced.
The initial integration method required you to download a PreEmptive.Dotfuscator.Xamarin.targets
file, and some external documentation and blog posts might still direct you to do so.
However, as of Dotfuscator Professional v4.37, that is no longer necessary, and the integration is much easier to use.
Please follow the appropriate instructions for your version of Dotfuscator:
- For Dotfuscator Professional, please follow the instructions on the current page from the top.
- For Dotfuscator Community, see the latest integration instructions for Xamarin in the Dotfuscator Community documentation.