就像标题中所说的,我试图将Dotfuscator community
与netstandard项目一起使用。
对于xamarin项目,我已经做到了,方法是this
它实际上不适用于netstandard和net core项目。
对于net standard2.0,我尝试使用this guid,但由于我使用的是Visual Studio 2019附带的免费版本。我找不到PreEmptive.Dotfuscator.Common.targets
所以您知道我可以使用的命令行或其他设置吗?
这是我尝试过的。 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>
在项目内部
<Target Name="CustomAfterBuild" AfterTargets="AfterBuild" >
<Message Text="Should run after build" Importance="High" />
<Exec Command=""C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscatorCLI.exe" Dotfuscator.xml" />
</Target>
我收到错误
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
日志
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 ==========
答案 0 :(得分:0)
您提到的MSBuild integration是Dotfuscator Professional专用的。
Dotfuscator社区有一个separate integration exclusive for Xamarin apps,包括那些引用.NET Standard库的人。
对于其他平台,Dotfuscator社区仅支持“后构建”方案,在这种情况下,您必须在已构建的程序集(.dll
和.exe
文件)上运行Dotfuscator。
您将需要使用Dotfuscator Community user interface创建Dotfuscator配置文件(例如Dotfuscator.xml
),并指定应使用inputs to Dotfuscator的程序集。然后,您可以在构建结束时从自定义步骤调用Dotfuscator Community command line,以生成程序集的受保护版本。
(注意:我为Dotfuscator团队工作,并在我的工作中作答。)