func (wixFile *WixManifest) Normalize() error {
	wixFile.VersionOk = wixFile.Version
	v, err := semver.NewVersion(wixFile.Version)
	if err != nil {
		return fmt.Errorf("Failed to parse version '%v': %v", wixFile.Version, err)
	}
	okVersion := ""
	okVersion += strconv.FormatInt(v.Major(), 10)
	okVersion += "." + strconv.FormatInt(v.Minor(), 10)
	okVersion += "." + strconv.FormatInt(v.Patch(), 10)
	wixFile.VersionOk = okVersion
	if wixFile.Choco.ID == "" {
		wixFile.Choco.ID = wixFile.Product
	}
	if wixFile.Choco.Title == "" {
		wixFile.Choco.Title = wixFile.Product
	}
	if wixFile.Choco.Authors == "" {
		wixFile.Choco.Authors = wixFile.Company
	}
	if wixFile.Choco.Owners == "" {
		wixFile.Choco.Owners = wixFile.Company
	}
	if wixFile.Choco.Description == "" {
		wixFile.Choco.Description = wixFile.Product
	}
	wixFile.Choco.Tags += " admin"  
	for i, hook := range wixFile.Hooks {
		cmd := strings.Trim(hook.Command, " ")
		if len(cmd) > 0 && cmd[0] != '"' {
			words := strings.Split(cmd, " ")
			cmd = `"` + words[0] + `"` + cmd[len(words[0]):]
		}
		buf := &bytes.Buffer{}
		if err := xml.EscapeText(buf, []byte(cmd)); err != nil {
			return err
		}
		wixFile.Hooks[i].CookedCommand = buf.String()
	}
	for _, hook := range wixFile.Hooks {
		switch hook.When {
		case whenInstall:
			wixFile.InstallHooks = append(wixFile.InstallHooks, hook)
		case whenUninstall:
			wixFile.UninstallHooks = append(wixFile.UninstallHooks, hook)
		}
	}
	return nil
}
Normalize Appropriately fixes some values within the decoded json
It applies defaults values on the wix/msi property to
to generate the msi package.
It applies defaults values on the choco property to
generate a nuget package
package manifest
import (
	"bytes"
	"encoding/json"
	"encoding/xml"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"github.com/Masterminds/semver"
	"github.com/satori/go.uuid"
)
type WixManifest struct {
	Product        string       `json:"product"`
	Company        string       `json:"company"`
	Version        string       `json:"version,omitempty"`
	VersionOk      string       `json:"-"`
	License        string       `json:"license,omitempty"`
	UpgradeCode    string       `json:"upgrade-code"`
	Files          WixFiles     `json:"files,omitempty"`
	Directories    []string     `json:"directories,omitempty"`
	RelDirs        []string     `json:"-"`
	Env            WixEnvList   `json:"env,omitempty"`
	Shortcuts      WixShortcuts `json:"shortcuts,omitempty"`
	Choco          ChocoSpec    `json:"choco,omitempty"`
	Hooks          []Hook       `json:"hooks,omitempty"`
	InstallHooks   []Hook       `json:"-"`
	UninstallHooks []Hook       `json:"-"`
}
type ChocoSpec struct {
	ID             string `json:"id,omitempty"`
	Title          string `json:"title,omitempty"`
	Authors        string `json:"authors,omitempty"`
	Owners         string `json:"owners,omitempty"`
	Description    string `json:"description,omitempty"`
	ProjectURL     string `json:"project-url,omitempty"`
	Tags           string `json:"tags,omitempty"`
	LicenseURL     string `json:"license-url,omitempty"`
	IconURL        string `json:"icon-url,omitempty"`
	RequireLicense bool   `json:"require-license,omitempty"`
	MsiFile        string `json:"-"`
	MsiSum         string `json:"-"`
	BuildDir       string `json:"-"`
	ChangeLog      string `json:"-"`
}
const (
	whenInstall   = "install"
	whenUninstall = "uninstall"
)
var HookPhases = map[string]bool{
	whenInstall:   true,
	whenUninstall: true,
}
type Hook struct {
	Command       string `json:"command,omitempty"`
	CookedCommand string `json:"-"`
	When          string `json:"when,omitempty"`
}
type WixFiles struct {
	GUID  string   `json:"guid"`
	Items []string `json:"items"`
}
type WixEnvList struct {
	GUID string   `json:"guid"`
	Vars []WixEnv `json:"vars"`
}
type WixEnv struct {
	Name      string `json:"name"`
	Value     string `json:"value"`
	Permanent string `json:"permanent"`
	System    string `json:"system"`
	Action    string `json:"action"`
	Part      string `json:"part"`
}
type WixShortcuts struct {
	GUID  string        `json:"guid,omitempty"`
	Items []WixShortcut `json:"items,omitempty"`
}
type WixShortcut struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Target      string `json:"target"`
	WDir        string `json:"wdir"`
	Arguments   string `json:"arguments"`
	Icon        string `json:"icon"`  
}
func (wixFile *WixManifest) Write(p string) error {
	if p == "" {
		p = "wix.json"
	}
	byt, err := json.MarshalIndent(wixFile, "", "  ")
	if err != nil {
		return err
	}
	err = ioutil.WriteFile(p, byt, 0644)
	if err != nil {
		return err
	}
	return nil
}
func (wixFile *WixManifest) Load(p string) error {
	if p == "" {
		p = "wix.json"
	}
	if _, err := os.Stat(p); os.IsNotExist(err) {
		return err
	}
	dat, err := ioutil.ReadFile(p)
	if err != nil {
		return fmt.Errorf("JSON ReadFile failed with %v", err)
	}
	err = json.Unmarshal(dat, &wixFile)
	if err != nil {
		return fmt.Errorf("JSON Unmarshal failed with %v", err)
	}
	return nil
}
func (wixFile *WixManifest) SetGuids(force bool) (bool, error) {
	updated := false
	if wixFile.UpgradeCode == "" || force {
		wixFile.UpgradeCode = uuid.NewV4().String()
		updated = true
	}
	if wixFile.Files.GUID == "" || force {
		wixFile.Files.GUID = uuid.NewV4().String()
		updated = true
	}
	if (wixFile.Env.GUID == "" || force) && len(wixFile.Env.Vars) > 0 {
		wixFile.Env.GUID = uuid.NewV4().String()
		updated = true
	}
	if (wixFile.Shortcuts.GUID == "" || force) && len(wixFile.Shortcuts.Items) > 0 {
		wixFile.Shortcuts.GUID = uuid.NewV4().String()
		updated = true
	}
	return updated, nil
}
func (wixFile *WixManifest) NeedGUID() bool {
	need := false
	if wixFile.UpgradeCode == "" {
		need = true
	}
	if wixFile.Files.GUID == "" {
		need = true
	}
	if wixFile.Env.GUID == "" && len(wixFile.Env.Vars) > 0 {
		need = true
	}
	if wixFile.Shortcuts.GUID == "" && len(wixFile.Shortcuts.Items) > 0 {
		need = true
	}
	return need
}
func (wixFile *WixManifest) RewriteFilePaths(out string) error {
	var err error
	out, err = filepath.Abs(out)
	if err != nil {
		return err
	}
	for i, file := range wixFile.Files.Items {
		file, err = filepath.Abs(file)
		if err != nil {
			return err
		}
		wixFile.Files.Items[i], err = filepath.Rel(out, file)
		if err != nil {
			return err
		}
	}
	for _, d := range wixFile.Directories {
		d, err = filepath.Abs(d)
		if err != nil {
			return err
		}
		r, err := filepath.Rel(out, d)
		if err != nil {
			return err
		}
		wixFile.RelDirs = append(wixFile.RelDirs, r)
	}
	for i, s := range wixFile.Shortcuts.Items {
		if s.Icon != "" {
			file, err := filepath.Abs(s.Icon)
			if err != nil {
				return err
			}
			wixFile.Shortcuts.Items[i].Icon, err = filepath.Rel(out, file)
			if err != nil {
				return err
			}
		}
	}
	return nil
}