visual-studio.net-core.net-standard-2.0dotfuscator

Dotfuscator netstandard project using Dotfuscator community only


Like the title says, im trying to use Dotfuscator community with netstandard project.

I have already Done so with xamarin project By folowing this

And it dose not really work with netstandard and net core project.

For net standard2.0 i tried using this guid, but as im using the free version that are included in visual studio 2019. I cant find PreEmptive.Dotfuscator.Common.targets

So do you know a setup with maybe a commandline or something, i could use.

This is what i tried. Config.xml

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--This config file was generated by Dotfuscator. Please use the Dotfuscator Config Editor to modify.-->
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.5.dtd">
<dotfuscator version="2.3">
  <global>
    <option>debugauto</option>
  </global>
  <input>
    <loadpaths />
    <asmlist>
      <inputassembly refid="a1403c2e-befc-47f7-b609-503ab5bb2ab2">
        <option>honoroas</option>
        <option>stripoa</option>
        <option>library</option>
        <option>transformxaml</option>
        <file dir="E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\bin\Release\netcoreapp2.2" name="Youtube.Manager.Models.Container.dll" />
      </inputassembly>
    </asmlist>
  </input>
  <output>
    <!--<file dir="${configdir}\Dotfuscated" />-->
    <file dir="${configdir}\Dotfuscated" />
  </output>
  <renaming>
    <option>xmlserialization</option>
    <mapping>
      <mapoutput overwrite="true">
        <file dir="${configdir}\Dotfuscated" name="Map.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}" />
      <referencerule rulekey="{62bd3899-7d53-4336-8ca2-4e5dbae187d5}" />
    </referencerulelist>
  </renaming>
  <sos mergeruntime="true">
    <option>version:v4</option>
    <option>sendanalytics</option>
    <option>dontsendtamper</option>
  </sos>
  <smartobfuscation>
    <smartobfuscationreport verbosity="all" overwrite="true" />
  </smartobfuscation>
</dotfuscator>

Inside the project

  <Target Name="CustomAfterBuild" AfterTargets="AfterBuild" >
    <Message Text="Should run after build" Importance="High" />
    <Exec Command="&quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscatorCLI.exe&quot; Dotfuscator.xml" />
  </Target>

I get the error

Severity    Code    Description Project File    Line    Suppression State
Error   MSB3073 The command ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscatorCLI.exe" Dotfuscator.xml" exited with code 1.    Youtube.Manager.Models.Container    E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\Youtube.Manager.Models.Container.csproj    34  

The logg

1>Should run after build
1>Youtube.Manager.Models.Container -> E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\bin\Release\netcoreapp2.2\Youtube.Manager.Models.Container.dll
1>Should run after build
1>Dotfuscator Community Version 5.42.0.9514-e0e25f754
1>Copyright 2002-2019 PreEmptive Solutions, LLC All Rights Reserved.
1>Use of this software implies acceptance of accompanying license agreement.
1>
1>Dotfuscator Community Version 5.42.0.9514-e0e25f754
1>Copyright 2002-2019 PreEmptive Solutions, LLC All Rights Reserved.
1>Use of this software implies acceptance of accompanying license agreement.
1>
1>For personal use only. Please refer to the EULA distributed with The Software for details.
1>
1>For personal use only. Please refer to the EULA distributed with The Software for details.
1>
1>[Build Output] Loading Assemblies...
1>[Build Output]
1>[Build Output] Loading Assemblies...
1>[Build Output]
1>[Build Output] Running C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\ildasm.exe /OUT=C:\Users\alent\AppData\Local\Temp\~Youtube.9\Youtube.Manager.Models.Container.dll.il /TEXT /NOBAR /RAWEH /QUOTEALLNAMES /UTF8  /FORWARD E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\bin\Release\netcoreapp2.2\Youtube.Manager.Models.Container.dll
1>[Build Output]
1>[Build Output] Running C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\ildasm.exe /OUT=C:\Users\alent\AppData\Local\Temp\~Youtube.11\Youtube.Manager.Models.Container.dll.il /TEXT /NOBAR /RAWEH /QUOTEALLNAMES /UTF8  /FORWARD E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\bin\Release\netcoreapp2.2\Youtube.Manager.Models.Container.dll
1>[Build Output]
1>[Build Output] Read debugging symbols for module 'Youtube.Manager.Models.Container.dll'.
1>[Build Output] Read debugging symbols for module 'Youtube.Manager.Models.Container.dll'.
1>[Build Output]
1>[Build Output]
1>[Build Output] Processing instrumentation attributes...
1>[Build Output] Processing instrumentation attributes...
1>EXEC : [Build Output] warning : No SetupAttribute was found. Messages will not be sent for any configured analytics messages and/or checks.
1>EXEC : [Build Output] warning : No SetupAttribute was found. Messages will not be sent for any configured analytics messages and/or checks.
1>[Build Output]
1>[Build Output]
1>[Build Output] Analyzing Markup...
1>[Build Output] Analyzing Markup...
1>[Build Output]
1>[Build Output] Renaming...
1>[Build Output]
1>[Build Output]
1>[Build Output] Renaming...
1>[Build Output]
1>[Build Output] Updating Markup...
1>[Build Output]
1>[Build Output] Updating Markup...
1>[Build Output]
1>[Build Output] Writing map file to E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\Dotfuscated\Map.xml
1>[Build Output]
1>[Build Output] Writing map file to E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\Dotfuscated\Map.xml
1>[Build Output]
1>[Build Output] The process cannot access the file 'E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\Dotfuscated\Map.xml' because it is being used by another process.
1>[Build Output] Build Error.
1>[Build Output] Writing Assemblies...
1>[Build Output]
1>E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\Youtube.Manager.Models.Container.csproj(34,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscatorCLI.exe" Dotfuscator.xml" exited with code 1.
1>Done building project "Youtube.Manager.Models.Container.csproj" -- FAILED.
1>[Build Output] Running C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ilasm.exe /OUTPUT=C:\Users\alent\AppData\Local\Temp\~Youtube.9\stub-pdb\Youtube.Manager.Models.Container.dll /nologo  /quiet /dll  /PDB /resource=C:\Users\alent\AppData\Local\Temp\~Youtube.9\Youtube.Manager.Models.Container.dll.res C:\Users\alent\AppData\Local\Temp\~Youtube.9\Youtube.Manager.Models.Container.dll.il
1>[Build Output]
1>[Build Output]
1>[Build Output]
1>[Build Output] Wrote assembly "E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\bin\Release\netcoreapp2.2\Youtube.Manager.Models.Container.dll" to "E:\Projects\Youtube.Manager\Youtube.Manager.Models.Container\Dotfuscated\Youtube.Manager.Models.Container.dll"
1>[Build Output]
1>[Build Output]
1>[Build Output] Build Finished.
1>[Build Output]
1>[Build Output]
1>[Build Output] Types Renamed:  21 of 81  (25.93%)
1>[Build Output] Methods Renamed:  50 of 454  (11.01%)
1>[Build Output] Fields Renamed:  219 of 307  (71.34%)
1>[Build Output]
1>[Build Output] You might see better renaming results by disabling Library Mode for one or more of your assemblies.
1>[Build Output] Please see https://www.preemptive.com/dotfuscator/ce/docs/help/obfuscation_overview.html#library-mode
1>[Build Output] for additional information about enabling Library Mode and how to configure renaming exclusions.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Solution

  • The MSBuild integration you mentioned is exclusive to Dotfuscator Professional.

    Dotfuscator Community has a separate integration exclusive for Xamarin apps, including those that reference .NET Standard libraries.

    For other platforms, Dotfuscator Community only supports "post-build" scenarios, where you run Dotfuscator on already-built assemblies (.dll and .exe files). You will need to use the Dotfuscator Community user interface to create a Dotfuscator config file (e.g., Dotfuscator.xml), specifying which assemblies should be inputs to Dotfuscator. You can then call the Dotfuscator Community command line from a custom step at the end of your build to produce protected versions of your assemblies.

    (Note: I work for the Dotfuscator team and am answering this as part of my job.)