1

How can I Execute Obfuscar Before Fody.Costura Merge the Files Because Merged Files Are not obfuscated, using Fody.Costura compression or wihout it.

I've downloaded https://github.com/obfuscar/example.git project example for obfuscar, then I've installed Fody and Fody.Costura by nuget, But output example is not obfuscated if i check it with ILSpy project.

https://github.com/icsharpcode/ILSpy (ILSpy project to download compressed files and see dll code) https://github.com/G4224T/Fody-Costura-Decompress (To decompress fody costura files).

My obfuscar configuration is

<?xml version='1.0'?>
<Obfuscator>
  <Var name="InPath" value="." />
  <Var name="OutPath" value=".\Obfuscator_Output" />
  <Var name="HidePrivateApi" value="true" />
  <Var name="KeepPublicApi" value="false" />
  <Var name="KeyFile" value=".\test.snk" />

  <Module file="$(InPath)\BasicExampleExe.exe" />
  <!--<Module file="$(InPath)\BasicExampleLibrary.dll" />-->
</Obfuscator>

And in fody costura I've tried with

<Costura DisableCompression="true" />

and

<Costura DisableCompression="false" />

I want any option for obfuscate and merge files using this projects because are free, Thanks all

Zaha
  • 846
  • 10
  • 21

1 Answers1

1

I've found a workarround of this, and was to make a new form project in solution that reference the ofuscated dlls and exe, then in this new project install fody.costura nuget package, after it you need to change some configuration and code:

obsfucar.xml

<Obfuscator>
  <Var name="InPath" value="." />
  <Var name="OutPath" value=".\Obfuscator_Output" />
  <Var name="HidePrivateApi" value="true" />
  <Var name="KeepPublicApi" value="false" />
  <Var name="KeyFile" value=".\test.snk" />

  <Module file="$(InPath)\BasicExampleExe.exe">
    <!-- You need to ommit afuscate startup form to call it from new project with fody.costura -->
    <SkipType name="BasicExampleExe.ExampleUI" />
  </Module>
  <Module file="$(InPath)\BasicExampleLibrary.dll" />
</Obfuscator>

Then in the Program class of the new project with fody.costura

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace ObfuscatorBeforeFodyCostura
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new BasicExampleExe.ExampleUI());//Edit this part with the ofuscated form.
        }
    }
}

Here the solution project edited: git clone https://juandrn@bitbucket.org/juandrn/obfuscatorbeforefodycostura.git

Thanks!

Zaha
  • 846
  • 10
  • 21