3

I am trying to use PreEmptive Solutions - Dotfuscator with my Xamarin.IOS app, but the build fails and I am getting this error:

I have done all the steps from here:

https://www.preemptive.com/obfuscating-xamarin-with-dotfuscator

My Xamarin.Android works fine, but the IOS project fails.

The error:

The command ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\PreEmptive Solutions\Dotfuscator and Analytics Community Edition\dotfuscatorCLI.exe" /p:InDir="obj\iPhone\Release\DotfuscatorXamarin\dfin",OutDir="obj\iPhone\Release\DotfuscatorXamarin\dfout",ReportDir="DotfuscatorReports\iPhone\Release" "DotfuscatorConfig.xml"" exited with code 1.

Any idea how I can fix it?

Update 29-06-2017: Content of DotfuscatorConfig.xml file for the Xamarin.IOS project

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.3.dtd">
<dotfuscator version="2.3">
  <propertylist>
    <property name="InDir" value="obj\iPhone\Release\DotfuscatorXamarin\dfin" />
    <property name="OutDir" value="obj\iPhone\Release\DotfuscatorXamarin\dfout" />
    <property name="ReportDir" value="DotfuscatorReports\iPhone\Release" />
  </propertylist>
  <global>
    <option>monocompat</option>
  </global>
  <input>
    <asmlist>
      <inputassembly refid="7cf160e1-e28e-4f81-bd8d-f10fdcbcc3f8">
        <option>honoroas</option>
        <option>stripoa</option>
        <option>library</option>
        <option>transformxaml</option>
        <file dir="${configdir}\${InDir}" name="MyProject.dll" />
      </inputassembly>
      <inputassembly refid="2d40ee83-3b30-421c-8b1a-fa4d404fb2d9">
        <option>honoroas</option>
        <option>stripoa</option>
        <option>library</option>
        <option>transformxaml</option>
        <file dir="${configdir}\${InDir}" name="MyProject.dll.mdb" />
      </inputassembly>
      <inputassembly refid="11652964-9a02-4f24-b042-25f260fada88">
        <option>honoroas</option>
        <option>stripoa</option>
        <option>library</option>
        <option>transformxaml</option>
        <file dir="${configdir}\${InDir}" name="MyProject.iOS.exe" />
      </inputassembly>
    </asmlist>
  </input>
  <output>
    <file dir="${configdir}\${OutDir}" />
  </output>
  <renaming>
    <option>xmlserialization</option>
    <mapping>
      <mapoutput overwrite="true">
        <file dir="${configdir}\${ReportDir}" name="Renaming.xml" />
      </mapoutput>
    </mapping>
    <referencerulelist>
      <referencerule rulekey="{6655B10A-FD58-462d-8D4F-5B1316DFF0FF}" />
      <referencerule rulekey="{7D9C8B02-2383-420f-8740-A9760394C2C1}" />
      <referencerule rulekey="{229FD6F8-5BCC-427b-8F72-A7A413ECDF1A}" />
      <referencerule rulekey="{2B7E7C8C-A39A-4db8-9DFC-6AFD38509061}" />
      <referencerule rulekey="{494EA3BA-B947-44B5-BEE8-A11CC85AAF9B}" />
      <referencerule rulekey="{89769974-93E9-4e71-8D92-BE70E855ACFC}" />
      <referencerule rulekey="{4D81E604-A545-4631-8B6D-C3735F793F80}" />
    </referencerulelist>
  </renaming>
  <sos mergeruntime="true">
    <option>version:v4</option>
    <option>disable</option>
    <option>dontsendtamper</option>
  </sos>
  <smartobfuscation>
    <smartobfuscationreport verbosity="all" overwrite="true">
      <file dir="${configdir}\${ReportDir}" name="SmartObfuscation.xml" />
    </smartobfuscationreport>
  </smartobfuscation>
</dotfuscator>

And for PreEmptive.Dotfuscator.Xamarin.targets file, I am using the one from the offical website. PreEmptive.Dotfuscator.Xamarin.targets

Hadi Al Tinawi
  • 429
  • 7
  • 22
  • Could you [increase the verbosity of the build output to "Normal"](https://learn.microsoft.com/en-us/visualstudio/ide/how-to-view-save-and-configure-build-log-files#to-change-the-amount-of-information-included-in-the-build-log)? That should show the Dotfuscator textual output itself and provide more information. *(Disclaimer, I work for PreEmptive and wrote the article you linked to.)* – Joe Sewell Jun 27 '17 at 16:26
  • The error happens at line 347 (Exec task) in PreEmptive.Dotfuscator.Xamarin.targets file. Also there is this error: PE Signature not found. Is this a PE file? – Hadi Al Tinawi Jun 28 '17 at 08:36
  • The error suggests that Dotfuscator is trying to process a file that's not a .NET assembly. That could be a problem with the build integration file, so it would be helpful for us at PreEmptive if you could edit the question to include the contents of the `DotfuscatorConfig.xml` file. If that's sensitive information, you can instead [start a trial of Dotfuscator Professional](https://www.preemptive.com/products/dotfuscator/downloads) and [contact the support team](https://www.preemptive.com/contact/supportrequestform). – Joe Sewell Jun 28 '17 at 13:47
  • @JoeSewell Thank you for helping. I have updated the question. – Hadi Al Tinawi Jun 29 '17 at 13:02

1 Answers1

2

As mentioned in the comments to the question, I work for PreEmptive Solutions. This is a bug in the Dotfuscator-Xamarin targets file (PreEmptive.Dotfuscator.Xamarin.targets), so sorry about that.

Note: This issue has been corrected in version 1.1.0 of the targets file. The latest version of the file can be downloaded on this page.

Specifically, when generating the initial Dotfuscator config file (DotfuscatorConfig.xml), we were treating an MDB (Mono debug symbol) file as an input assembly. The next version of the targets file will correct this issue.

To resolve this issue with version 1.0.0 of the targets file, please delete the following lines from DotfuscatorConfig.xml:

  <inputassembly refid="2d40ee83-3b30-421c-8b1a-fa4d404fb2d9">
    <option>honoroas</option>
    <option>stripoa</option>
    <option>library</option>
    <option>transformxaml</option>
    <file dir="${configdir}\${InDir}" name="MyProject.dll.mdb" />
  </inputassembly>

The targets file will use your corrected version from then on.

Joe Sewell
  • 6,067
  • 1
  • 21
  • 34
  • It works now after I deleted the lines, thanks a lot. – Hadi Al Tinawi Jun 30 '17 at 07:26
  • Hello. I tried to intagrate dotfuscator to my Xamarin proj according manual :: `https://www.preemptive.com/dotfuscator/ce/docs/help/getting_started_xamarin.html` and when I start building, did seen the strange message into build log -`There are no assemblies to process. Stopping the build`. And I dont understand - what's problem ? I just start building and of course I haven't .apk file yet, and noone xamarin.dll's whitch I need to obfuscate. – Сергей Aug 30 '19 at 11:28