Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting clarity on generate-templates usage #25

Open
solvingj opened this issue Jun 25, 2017 · 1 comment
Open

Requesting clarity on generate-templates usage #25

solvingj opened this issue Jun 25, 2017 · 1 comment

Comments

@solvingj
Copy link
Contributor

Go-msi comes with some default templates in the program directory, but it also allows the user to provide a custom "src" template, and a custom "out" template. It's just not clear to me how the generator uses the source template to generate a new template. Maybe it's because I've not used wix before.

I thought I would take the wix templates provided, edit them manually, and add the modified versions to my repository (just like one does with wix.json). It's just confusing to me to use a template generator to generate new templates based on existing templates. And then do i still have to manually edit the generated templates? Any additional explanation would help. Thanks!

The help for go-msi is below.

USAGE:
   go-msi generate-templates [command options] [arguments...]

OPTIONS:
   --path value, -p value     Path to the wix manifest file (default: "wix.json")
   --src value, -s value      Directory path to the wix templates files (default: "C:\\Program Files\\go-msi\\templates")
   --out value, -o value      Directory path to the generated wix templates files (default: "C:\\Users\\me\\AppData\\Local\\Temp\\go-msi806034671")
   --version value            The version of your program
   --license value, -l value  Path to the license file
@mh-cbon
Copy link
Owner

mh-cbon commented Aug 23, 2017

generate-templates sub command is an helper tool to validate the golang templating implementation, nothing more. make sub command will regenerate the template appropriately JIT.

The templates located at https://github.com/mh-cbon/go-msi/tree/master/templates are primarily golang templates
see for example those expressions https://github.com/mh-cbon/go-msi/blob/master/templates/product.wxs#L104

This pre-processing in golang is necessary to inject a ton of information into the wix templates.

The wix templates, once pre-processed, are provided as is to wix tool set. Under the wix universe, the operator/developer/whatever-people would manually write the wix templates, before calling for the wix binaries.
The generate-template helps to test and to reproduce this manual process.

To benefit of go-msi simplicity with some tailor made wix templates, you need to duplicate them, probably into your repo, as you did, they contains the golang template expressions.
You must keep those golang templating expressions and work around them to implement your installer features.
Those expressions are the helpers that reflects the configuration put into the wix.json file.

At worst, if you remove those expressions, it would be the same as removing features of go-msi, or ignoring some parts of the wix.json file you declared.

When generating the msi file with go-msi make, do not forget to pass in your special templates via the --src,-s flag to instruct the program the location of the wix files to consume.
You do not need to keep the same file names (LicenseAgreementDlg_HK.wxs / WixUI_HK.wxs / product.wxs).
They must be in the root directory of the value of --src

$ tree -L 1
.
├── choco
├── LicenseAgreementDlg_HK.wxs
├── product.wxs
└── WixUI_HK.wxs

1 directory, 3 files

It's just confusing to me to use a template generator to generate new templates based on existing templates.

its just confusing anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants