1
votes

I am working on Xamarin forms project (with portable project) I am trying to obfuscate the portable dll using .Net Reactor I have done that using a batch file which is set as a post build event for the portable project and everything works fine (i.e the generated dll is obfuscated successfully ) here is the script code

    "C:\Program Files (x86)\Eziriz\.NET Reactor\dotNET_Reactor.exe" -project 
    "reactor.nrproj" -file "myProject.dll"
  copy "myProject_Secure\myProject.dll" "myProject.dll"

the problem is when I build the droid project I got the following error

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Windows.dll' at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 220 at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver) myProject.Droid

I am sure that problem comes from the obfuscation because everything works fine without the obfuscation

Does anybody work with .Net reactor to obfuscate Xamarin forms projects?

BTW, I have un-check all the quick settings of the .Net reactor and the problem is still shows up

2

2 Answers

0
votes

Obfuscating of Xamarin Android is useless its better to turn on "Embed assemblies to native code" which will convert all code into a binary .so file. so it will be difficult for hacker or reverse engineer to read that code and do reverse engineering.you can use AOT but that is in experimental and might create problem for some device after updated on play store. in order to play safe i would suggest to go with "Embed assemblies to native code"

0
votes

You need to set "2. Protection Settings"->"Anti ILDASM"->"Suppress Decompilation" to "False" as it confuses the build process in this case. In case it still doesn't work set "1. General Settings"->"Project Targets Mono Framework" to "True".