'How to use Wildcards in Obfuscator XML

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.



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matt