Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using .Net Reactor for obfuscation. Obfuscation will be done as part of the compilation in our pipeline.We have requirement to apply version to compiled exe.
We are using tool called "ILMerge" to set version. Exe is working fine if we set version for unobfuscated exe but if we do same for obfuscated exe it is getting crashed.

var utility = new ILMerging.ILMerge()
    Version = new Version(version),
    OutputFile = exe,
    DebugInfo = false

utility.SetInputAssemblies(new[] { exe });

Eventviwer is showing below error :

with exception code: 0xe0434352 from KERNELBASE.dll

What I have tried:

I did try searching any available versioning tools as alternatives to test but couldn't find them.
Planned to update assmblyinfo.cs files before compilation with the version required but with our process, it is not possible.

Do we have any tools available for versioning .Net exe after compilation?
I couldn't figure out what exact crash issue is, can you help any available method to figure it out?
Updated 31-May-22 6:47am

1 solution

I'll preface this with the statement that I have never used either one of those tools.

However, I've done a lot of work with other obfuscators. It's been my experience that once a binary is obfuscated, you cannot change it. I've tried to change both C# assemblies and C DLLs after applying obfuscation, and neither would work correctly. Unless you know the nitty gritty details of the obfuscator, you've got no idea how it dynamically unpacks / unobfuscates the binary as it is being loaded. Any after-the-fact changes will usually disrupt that process and make the binary unusable, as you're finding out.

You mention version information ... Stupid question but, have you checked that the version is not visible from the obfuscated assembly? I've used a couple of obfuscators, and they all created binaries where the version information was visible when viewing the properties of the file. If not, check your obfuscator's documentation. There may be some way to exclude the versioning information from obfuscation.

You say you have to apply versioning later in your pipeline, after the build. I have the feeling you're going to have to separate your build into pieces where the "normal" build is one part and the obfuscation is the second. Then insert the versioning element of your pipeline between those two. My experience says you can't do versioning (or anything else) after obfuscation.
Share this answer
chankayudu 31-May-22 13:17pm    
Thank you for the reply. Yes, these are my observations as well. I think the only way is to apply the version before obfuscation.
OriginalGriff 31-May-22 16:37pm    
Versioning should definitely be part of the build process, and as early as possible - certainly before obfuscation (which should be the last part of the process if used). :thumbsup:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900