wails/website/docs/reference/project-config.mdx
Lea Anthony e3dbe294f2 fix: Add Windows UAC execution level support to manifest template
Fixes #4349: Windows admin permissions not persisting between machines

This change adds configurable UAC (User Account Control) execution level
support to the Windows manifest template, allowing developers to specify
admin requirements that persist when executables are distributed.

## Changes Made

### Enhanced Windows Manifest Template
- Added conditional UAC `trustInfo` section to manifest template
- Uses template variable `{{.ExecutionLevel}}` for dynamic configuration
- Backward compatible: no UAC section when execution level not specified

### Project Configuration Support
- Added `WindowsInfo` struct to project configuration
- Added `executionLevel` field for specifying UAC requirements
- Integrated execution level into template data processing

### Template Data Enhancement
- Extended `assetData` struct to include execution level
- Updated template resolution to extract Windows-specific configuration
- Maintained backward compatibility with existing projects

### Documentation Updates
- Added comprehensive Windows UAC guide with examples
- Updated project configuration reference with Windows options
- Included usage examples and supported execution levels

## Usage

Developers can now specify execution level in wails.json:

```json
{
  "info": {
    "windows": {
      "executionLevel": "requireAdministrator"
    }
  }
}
```

Supported values:
- `requireAdministrator`: Requires admin privileges
- `asInvoker`: Runs with invoker's privileges
- `highestAvailable`: Runs with highest available privileges

## Testing

Verified that:
- UAC trustInfo section is properly embedded in Windows executables
- Admin privileges persist when executables are copied between machines
- Backward compatibility maintained for existing projects
- Template processing works correctly during build

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-12 22:03:07 +10:00

135 lines
6.5 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebar_position: 5
---
# Project Config
The project config resides in the `wails.json` file in the project directory. The structure of the config is:
```json5
{
// Project config version
"version": "",
// The project name
"name": "",
// Relative path to the directory containing the compiled assets, this is normally inferred and could be left empty
"assetdir": "",
// Additional directories to trigger reloads (comma separated), this is only used for some advanced asset configurations
"reloaddirs": "",
// The directory where the build files reside. Defaults to 'build'
"build:dir": "",
// Relative path to the frontend directory. Defaults to 'frontend'
"frontend:dir": "",
// The command to install node dependencies, run in the frontend directory - often `npm install`
"frontend:install": "",
// The command to build the assets, run in the frontend directory - often `npm run build`
"frontend:build": "",
// This command has been replaced by frontend:dev:build. If frontend:dev:build is not specified will falls back to this command. \nIf this command is also not specified will falls back to frontend:build
"frontend:dev": "",
// This command is the dev equivalent of frontend:build. If not specified falls back to frontend:dev
"frontend:dev:build": "",
// This command is the dev equivalent of frontend:install. If not specified falls back to frontend:install
"frontend:dev:install": "",
// This command is run in a separate process on `wails dev`. Useful for 3rd party watchers or starting 3d party dev servers
"frontend:dev:watcher": "",
// URL to a 3rd party dev server to be used to serve assets, EG Vite. \nIf this is set to 'auto' then the devServerUrl will be inferred from the Vite output
"frontend:dev:serverUrl": "",
// Relative path to the directory that the auto-generated JS modules will be created
"wailsjsdir": "",
// The name of the binary
"outputfilename": "",
// The default time the dev server waits to reload when it detects a change in assets
"debounceMS": 100,
// Address to bind the wails dev sever to. Default: localhost:34115
"devServer": "",
// Arguments passed to the application in shell style when in dev mode
"appargs": "",
// Defines if build hooks should be run though they are defined for an OS other than the host OS.
"runNonNativeBuildHooks": false,
"preBuildHooks": {
// The command that will be executed before a build of the specified GOOS/GOARCH: ${platform} is replaced with the "GOOS/GOARCH". The "GOOS/GOARCH" hook is executed before the "GOOS/*" and "*/*" hook.
"GOOS/GOARCH": "",
// The command that will be executed before a build of the specified GOOS: ${platform} is replaced with the "GOOS/GOARCH". The "GOOS/*" hook is executed before the "*/*" hook.
"GOOS/*": "",
// The command that will be executed before every build: ${platform} is replaced with the "GOOS/GOARCH".
"*/*": ""
},
"postBuildHooks": {
// The command that will be executed after a build of the specified GOOS/GOARCH: ${platform} is replaced with the "GOOS/GOARCH" and ${bin} with the path to the compiled binary. The "GOOS/GOARCH" hook is executed before the "GOOS/*" and "*/*" hook.
"GOOS/GOARCH": "",
// The command that will be executed after a build of the specified GOOS: ${platform} is replaced with the "GOOS/GOARCH" and ${bin} with the path to the compiled binary. The "GOOS/*" hook is executed before the "*/*" hook.
"GOOS/*": "",
// The command that will be executed after every build: ${platform} is replaced with the "GOOS/GOARCH" and ${bin} with the path to the compiled binary.
"*/*": ""
},
// Data used to populate manifests and version info.
"info": {
// The company name. Default: [The project name]
"companyName": "",
// The product name. Default: [The project name]
"productName": "",
// The version of the product. Default: '1.0.0'
"productVersion": "",
// The copyright of the product. Default: 'Copyright.........'
"copyright": "",
// A short comment of the app. Default: 'Built using Wails (https://wails.app)'
"comments": "",
// File associations for the app
"fileAssociations": [
{
// The extension (minus the leading period). e.g. png
"ext": "wails",
// The name. e.g. PNG File
"name": "Wails",
// Windows-only. The description. It is displayed on the `Type` column on Windows Explorer.
"description": "Wails file",
// The icon name without extension. Icons should be located in build folder. Proper icons will be generated from .png file for both macOS and Windows)
"iconName": "fileIcon",
// macOS-only. The apps role with respect to the type. Corresponds to CFBundleTypeRole.
"role": "Editor"
},
],
// Custom URI protocols that should be opened by the application
"protocols": [
{
// protocol scheme. e.g. myapp
"scheme": "myapp",
// Windows-only. The description. It is displayed on the `Type` column on Windows Explorer.
"description": "Myapp protocol",
// macOS-only. The apps role with respect to the type. Corresponds to CFBundleTypeRole.
"role": "Editor"
}
],
// Windows-specific configuration
"windows": {
// UAC execution level for Windows applications. Valid values: "requireAdministrator", "highestAvailable", "asInvoker"
"executionLevel": ""
}
},
// 'multiple': One installer per architecture. 'single': Single universal installer for all architectures being built. Default: 'multiple'
"nsisType": "",
// Whether the app should be obfuscated. Default: false
"obfuscated": "",
// The arguments to pass to the garble command when using the obfuscated flag
"garbleargs": "",
// Bindings configurations
"bindings": {
// model.ts file generation config
"ts_generation": {
// All generated JavaScript entities will be prefixed with this value
"prefix": "",
// All generated JavaScript entities will be suffixed with this value
"suffix": "",
// Type of output to generate (classes|interfaces)
"outputType": "classes",
}
}
}
```
This file is read by the Wails CLI when running `wails build` or `wails dev`.
The `assetdir`, `reloaddirs`, `wailsjsdir`, `debounceMS`, `devserver` and `frontenddevserverurl` flags in `wails build/dev` will update the project config
and thus become defaults for subsequent runs.
The JSON Schema for this file is located [here](https://wails.io/schemas/config.v2.json).