Skip to content

[v3] default taskfile "package" fails on Windows #4667

@TwoNull

Description

@TwoNull

Description

When initializing a new project on v3-alpha 36, the default build/windows taskfile's package task fails if attempting to package a NSIS installer on a Windows host machine. I first get an exception trying to run the shell conditional to choose between create:nsis:installer and create:msix:package. If I patch this out of the taskfile, I then get an error in the create:nsis:installer task where makensis will fail due to being given a binary path argument with mixed path separators (/ and \). Running wails3 update build-assets does not fix either issue. I haven't tested whether the create:msix:package task also has the mixed path separator problem.

To Reproduce

Create a new Wails project

wails3 init -n testapp -t react-ts

Attempt to package an installer on a Windows host machine using NSIS (default)

wails3 package

Expected behaviour

A NSIS installer should be generated.

Screenshots

No response

Attempted Fixes

  1. The package task can be easily converted to use Taskfile conditionals
cmds:
      - task: '{{if eq (.FORMAT | default "nsis") "msix"}}create:msix:package{{else}}create:nsis:installer{{end}}'
  1. My fix for create:nsis:installer was the following conditional statement that switches the path argument by OS
cmds:
      # Create the Microsoft WebView2 bootstrapper if it doesn't exist
      - wails3 generate webview2bootstrapper -dir "{{.ROOT_DIR}}/build/windows/nsis"
      - | 
        {{if eq OS "windows"}}
        makensis -DARG_WAILS_{{.ARG_FLAG}}_BINARY="{{.ROOT_DIR}}\{{.BIN_DIR}}\{{.APP_NAME}}.exe" project.nsi
        {{else}}
        makensis -DARG_WAILS_{{.ARG_FLAG}}_BINARY="{{.ROOT_DIR}}/{{.BIN_DIR}}/{{.APP_NAME}}.exe" project.nsi
        {{end}}

System Details

Wails (v3.0.0-alpha.36)  Wails Doctor 

# System 

┌─────────────────────────────────────────┐
| Name              | Windows 10 Pro      |
| Version           | 2009 (Build: 19045) |
| ID                | 22H2                |
| Branding          | Windows 10 Pro      |
| Platform          | windows             |
| Architecture      | amd64               |
| Go WebView2Loader | true                |
| WebView2 Version  | 141.0.3537.99       |
| CPU               | Unknown             |
| GPU               | Unknown             |
| Memory            | Unknown             |
└─────────────────────────────────────────┘

# Build Environment 

┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI      | v3.0.0-alpha.36                                                                    |
| Go Version     | go1.25.1                                                                           |
| -buildmode     | exe                                                                                |
| -compiler      | gc                                                                                 |
| CGO_ENABLED    | 0                                                                                  |
| DefaultGODEBUG | containermaxprocs=0,decoratemappings=0,tlssha1=1,updatemaxprocs=0,x509sha256skid=0 |
| GOAMD64        | v1                                                                                 |
| GOARCH         | amd64                                                                              |
| GOOS           | windows                                                                            |
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies 

┌────────────────────────────────────────────┐
| MakeAppx.exe (Windows SDK) | Not Installed |
| MSIX Packaging Tool        | Not Installed |
| SignTool.exe (Windows SDK) | Not Installed |
| npm                        | 11.6.0        |
| NSIS                       | v3.11         |
|                                            |
└───────── * - Optional Dependency ──────────┘

# Checking for issues 

 SUCCESS  No issues found

# Diagnosis 

 SUCCESS  Your system is ready for Wails development!

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions