How to include prerequisites with msi/Setup.exe in WIX

后端 未结 4 1204
生来不讨喜
生来不讨喜 2020-12-01 15:23

I\'m trying to combine my package in a single setup EXE file and upload it to the Internet.

I have created a Microsoft bootstrapper that contains Setup.exe with proj

4条回答
  •  被撕碎了的回忆
    2020-12-01 15:51

    You can use something like NSIS to wrap up your bootstrapper and MSI. You'll need to write a simple NSIS script, like this:

    !define PRODUCT_NAME "YourProductNameHere"
    
    Name "${PRODUCT_NAME}"
    OutFile "SetupWrapper.exe"
    Icon "Setup.ico"
    BrandingText " "
    SilentInstall silent
    
    Section
    
      SetOutPath "$TEMP\${PRODUCT_NAME}"
    
      ; Add all files that your installer needs here
      File "setup.exe"
      File "product.msi"
    
      ExecWait "$TEMP\${PRODUCT_NAME}\setup.exe"
      RMDir /r /REBOOTOK "$TEMP\${PRODUCT_NAME}"
    
    SectionEnd
    

    Save this to a file named SetupWrapper.nsi, and edit the product name and paths to setup.exe and your MSI file. Now you can build this file to get a single EXE file that contains the bootstrapper and the MSI.

    When this EXE is run, it will not have any UI of its own -- it will simply extract your bootstrapper and MSI to a temp folder, then execute the bootstrapper, and clean up afterwards.

    You can also add a post-build step to your project to build this wrapper, which will automatically generate the combined wrapper EXE. To do this, you can add a command like this:

    path-to-NSIS\nsis-2.46\makensis.exe /V2 your-project-path\SetupWrapper.nsi
    

提交回复
热议问题