仅使用 Dotfuscator 社区的 Dotfuscator netstandard 项目

Dotfuscator netstandard project using Dotfuscator community only

正如标题所说,我正在尝试将 Dotfuscator community 与 netstandard 项目一起使用。

我已经使用 xamarin 项目完成了以下操作 this

而且它并不真正适用于 netstandard 和 net core 项目。

对于 net standard2.0,我尝试使用 this guid,但我使用的是 visual studio 2019 中包含的免费版本。我找不到 PreEmptive.Dotfuscator.Common.targets

那么你知道我可以使用命令行或其他东西的设置吗?

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 Studio19\Professional\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscatorCLI.exe&quot; Dotfuscator.xml" />
  </Target>

我收到错误

Severity    Code    Description Project File    Line    Suppression State
Error   MSB3073 The command ""C:\Program Files (x86)\Microsoft Visual Studio19\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 Studio19\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 ==========

您提到的 MSBuild integration 是 Dotfuscator Professional 独有的。

Dotfuscator 社区有一个 separate integration exclusive for Xamarin apps,包括那些引用 .NET Standard 库的社区。

对于其他平台,Dotfuscator Community 仅支持 "post-build" 场景,您在 already-built 程序集(.dll.exe 文件)上 运行 Dotfuscator。 您将需要在构建结束时使用自定义步骤中的 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 来生成程序集的受保护版本。

(注意:我在 Dotfuscator 团队工作,作为我工作的一部分回答这个问题。)