I am trying to create an application can modify properties in IL to create a slightly different executable. E.g Client A runs app and a label on the WinForm label Reads “Client A:”. Client B runs the app and Label Says “Client B”. Easy I know using config files or resource files but thats not an option for this project. The Main program needs to be able to generate .exe file dynamically based on some form fields entered by user.
My solution was to create a standalone executable that contained all the elements which I needed to make dynamic. I then used ildasm to generate the IL and thought that I could use this IL and substitute tags for the elements i wanted to make dynamic. I could then replace those tags at runtime after user filled the form using regex etc.
The problem is, the if i re save the IL file generated by ILDASM as an exe and try to run it. I just launches console and does nothing.
Am I going about this the wrong way? I didnt want to delve into Reflection as the dynamic .exe is a really simple one and I thought reverse engineering IL with ildasm would be the quickest way.
You thoughts and pointers are much appreciated.
Tony
Is the executable generated on-site? Or do you generate the executable for a customer and then ship the result?
If you are the one generating the executable, you could put the customer-specific data/code in a separate DLL and embed it in your executable as a resource, and load it when the AppDomain.CurrentDomain.AssemblyResolve event occurs.
That way you can have version control over the customer-specific data.