I have an installer project that is generating .msi on build. In the pre-build event, I am calling Confuser.CLI.exe to obfuscate code, but exe is working asynchronous and taking too much time, and the compiler is finished before exe, so I have .msi with old DLLs and then when .msi is generated, new DLLs overwrite old ones. I even tried with the post-build event, but I get the same result.
Asked
Active
Viewed 317 times
1
Serlok
- 432
- 1
- 10
- 24
1 Answers
0
Inside installer project - .wixproj, I put 2 targets that will execute different commands:
<Target Name="ConfuserExScript" AfterTargets="CopyReferencedProjects">
<Exec Command="Powershell.exe -executionpolicy remotesigned -File "$(SolutionDir)Installers\Scripts\Build\PostBuild_RunConfuserEx.ps1" "$(SolutionDir)\"" />
</Target>
<Target Condition=" '$(ConfigurationName)' == 'ReleaseDC' " Name="Obfuscator" AfterTargets="ConfuserExScript">
<Exec Command="$(SolutionDir)Installers\ConfuserEx\Confuser.CLI.exe $(ProjectDir)ConfuserOutput.crproj" />
</Target>
The first one is gathering DLLs and creating crproj file for ConfuserEx, the second one is running Confuser.CLI.exe and obfuscating code.
Important thing is that I use afterTargets so the second line is executed after the first one is finished.
Serlok
- 432
- 1
- 10
- 24