Search code examples
xamarinxamarin.iosdotfuscatorpreemptive

Dotfuscator command exited with code 1 xamarin.ios


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


Solution

  • 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.