How to use Wildcards in Obfuscator XML

221 Views Asked by At

I have a Obfuscator XML that obfuscates the hardcoded file names

<?xml version="1.0" encoding="utf-8" ?>
<Obfuscator>
  <Var name="InPath" value="." />
  <Var name="OutPath" value="Obfuscator_Output" />
  <Module file="$(InPath)\Pranay.Hi.abc.GeneratorToken.dll" />
  <Module file="$(InPath)\Pranay.Hi.abc.HandlerException.dll" />
  <Module file="$(InPath)\Pranay.Hi.abc.CertHandling.dll" />
  
</Obfuscator>

Instead of hardcoding the files name, is there any way to include all the files by giving something like so that all files starting from Pranay. are included and we don't need to hardcode them at all.

1

There are 1 best solutions below

0
On

You can include files using wildcards with the following configuration:

  <Modules>
    <IncludeFiles>$(InPath)\Pranay.Hi.abc.*.dll</IncludeFiles>
  </Modules>

The author of this feature provided an example that can be viewed here. I have also provided their example below:

<Module file="$(InPath)\SomeFile.dll">
    <Include path="obfuscar.skip.xml" />
</Module>
<Modules>
   <IncludeFiles>$(InPath)\Acme.*.dll</IncludeFiles>
   <ExcludeFiles>$(InPath)\Acme*Tests.dll</ExcludeFiles>
   <Include path="obfuscar.skip.xml" />
</Modules>

The documentation for this feature hasn't been written at the time of writing this answer. It should be linked here once available.