-1

I made a setup project and I want to add a locked .exe instead of the compiled .exe in my setup. Can this be done with a custom action or some other way?

PhilDW
  • 20,260
  • 1
  • 18
  • 28
rippergr
  • 182
  • 2
  • 20
  • 1
    What is a "locked .exe"? – Ron Beyer Apr 18 '18 at 18:47
  • When I compile my project it creates an exe file. I then run an application the it "locks" it so it asks for a key to run it. – rippergr Apr 18 '18 at 19:14
  • You can add any exe you want to the setup project with "Add File" or drag and drop into the File System view, if that is what you are asking. – PhilDW Apr 19 '18 at 18:08
  • @PhilDW I know that but my problem is that I want to change to executable of the program. So if I put another exe I want when the installation finish to replace the original executable with the one I put as extra. – rippergr Apr 19 '18 at 18:15
  • It's still not clear exactly when you want this to happen, but after you have built the first exe, you can add a post-build event that modifies the exe to do your locking, and then you build the MSI and it will contain the locked exe. That's the way you include it in your MSI. – PhilDW Apr 19 '18 at 19:38
  • @PhilDW That will do the job. Can you give me more details on how can I achieve that? – rippergr Apr 20 '18 at 05:26

1 Answers1

0

You can add any exe you want to the setup project with "Add File" or drag and drop into the File System view, if that is what you are asking.

If you want to alter the built exe, you can add a post-build event that modifies the exe to do your locking, and then you build the MSI and it will contain the locked exe. That's the way you include it in your MSI.

Setup projects don't have much functionality for build events, so use the Visual Studio build of your code and add a post-build event. There are macros for the locations of the inputs, outputs, and any programs you want to run. It's fairly intuitive, I found, but you'd need to look up articles on using post-build events - or ask in the appropriate Visual Studio forum (rather than install related).

PhilDW
  • 20,260
  • 1
  • 18
  • 28