Hi everyone, long time no write anything, but I had a lot of projects and stresses to study, but now, we'll create a .msi file for go program
Pre-requisites
- go is installed
- wixtoolset it's very important
What's we'll use?
Package go-msi helps to generate MSI package for a Go project.
installation
by go
go get github.com/mh-cbon/go-msi
by Chocolatey
choco install go-msi
for more, visit https://mh-cbon.github.io/go-msi/#install
ok, now let's create a simple go file msi.go
package main import "fmt" func main() { fmt.Println("Gen MSI File") }
build it
go build
wix.json
to create a .msi file, we need wix.json
{ "product": "YOUR_PRODUCT_NAME", "company": "YOUR_COMPANY_NAME", "license": "LICENSE", "upgrade-code": "", "files": { "guid": "", "items": [ "path/to/msi.exe", ] }, "env": { "guid": "", "vars": [ { "name": "PATH", "value": "[INSTALLDIR]", "permanent": "no", "system": "no", "action": "set", "part": "last" } ] }, "shortcuts": {}, "choco": { "description": "YOUR_DESC", "project-url": "YOUR_PROJECT_URL", "tags": "TAGS YOU NEED", "license-url": "YOUR_LICENSE_URL" } }
our guid
props are empty, run this command
go-msi set-guid
Create Interfaces
we'll create three user interfaces
- License Agreement Page
- WiX UI
- Product Page
now create three files
LicenseAgreementDlg_HK.wsx
product.wsx
WixUI_HK.wsx
download these files here
put these files in folder, like templates folder
Generate
go-msi make --msi YOUR_PRODUCT_NAME.msi --version YOUR_VERSION -s ./path/to/*.wsx
now you can test your msi file
👋
Top comments (4)
Thank you for this tutorial. It works!
What can I do if I want to run one of my exe files during or after the install?
I got it working. I got help from this: wixtoolset.org/documentation/manua...
So the end of product.wxs looks like this now:
nice
Nice tutorial.
One question, how can I modify wix.json for storing error logs of installed app to a file?