Can I force the installer project to use the .config file from the built solution instead of the original one?

前端 未结 7 1260
我在风中等你
我在风中等你 2021-02-01 09:41

I am using the solution to this question in order to apply configuration changes to App.config in a Winforms project. I also have an installer project for the proj

7条回答
  •  伪装坚强ぢ
    2021-02-01 10:01

    The question is old, but the following could still help many folks out there.

    I would simply use Wix WiFile.exe to replace the concerned file in the msi this way (for the sake of this example, we call your msi yourPackage.msi):

    Step 1. From command prompt run: WiFile.exe "yourPackage.msi" /x "app.exe.config." The above will extract the "wrong" app.exe.config file from the msi and place it the same directory as your msi;

    Step 2. Place the new (prod) config file (must have the same name as the extracted file: app.exe.config) in same location as your msi; This means that you are overwritting the app.exe.config that has just been extracted in step 1 above, with your new (production config file);

    Step 3. From command prompt run: WiFile.exe "yourPackage.msi" /u "app.exe.config."

    THAT'S ALL!

    The above can be done in a few seconds. You could automate the task if you wanted, for instance, by running it as batch or else.

    After running step 3 above, your msi will contain the new config file, which will now be installed at your clients' when they run the setup.

提交回复
热议问题