$npx -y skills add BoltzmannEntropy/OSXSkills --skill windows-flutter-exeBuild, verify, and package Flutter desktop apps for Windows into a distributable executable bundle (EXE plus required DLL/data dependencies, optional installer-ready artifacts). Use when a user asks to generate a Windows Flutter executable, ship a Windows desktop release, include
| 1 | # Windows Flutter Executable Packaging |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Produce a Windows Flutter release bundle that runs on end-user machines by packaging the complete `build/windows/x64/runner/Release` output instead of only the `.exe`. |
| 6 | Use this workflow to avoid broken deliveries caused by missing plugin DLLs, `flutter_windows.dll`, or `data/` assets. |
| 7 | |
| 8 | ## Required Inputs |
| 9 | |
| 10 | - App root containing `pubspec.yaml` |
| 11 | - Windows build host (or CI runner) with Flutter + Visual Studio C++ desktop workload |
| 12 | - Target architecture (default: `x64`) |
| 13 | - Output directory for shipping artifacts |
| 14 | |
| 15 | ## Workflow |
| 16 | |
| 17 | ### 1) Preflight |
| 18 | |
| 19 | - Confirm Windows target is enabled: |
| 20 | ```bash |
| 21 | flutter config --enable-windows-desktop |
| 22 | ``` |
| 23 | - Confirm toolchain: |
| 24 | ```bash |
| 25 | flutter doctor -v |
| 26 | ``` |
| 27 | - Ensure `flutter doctor` shows no blocking Windows desktop issues. |
| 28 | |
| 29 | ### 2) Build Release |
| 30 | |
| 31 | - From app root: |
| 32 | ```bash |
| 33 | flutter pub get |
| 34 | flutter build windows --release |
| 35 | ``` |
| 36 | - Release output location: |
| 37 | `build/windows/x64/runner/Release` |
| 38 | |
| 39 | ### 3) Bundle All Runtime Dependencies |
| 40 | |
| 41 | Package the full `Release` folder, not only `<app>.exe`. |
| 42 | Required runtime surfaces: |
| 43 | - `<app>.exe` |
| 44 | - `flutter_windows.dll` |
| 45 | - `data/` directory |
| 46 | - Plugin/native DLLs generated by Flutter plugins |
| 47 | |
| 48 | ### 4) Create a Distributable Archive |
| 49 | |
| 50 | Run the bundled helper: |
| 51 | |
| 52 | ```bash |
| 53 | bash ./skills/windows-flutter-exe/scripts/build_windows_flutter_bundle.sh \ |
| 54 | --app-root <APP_ROOT> \ |
| 55 | --out-dir <OUTPUT_DIR> |
| 56 | ``` |
| 57 | |
| 58 | This script can: |
| 59 | - Build Windows release |
| 60 | - Validate required runtime files |
| 61 | - Copy full Release payload into a versioned bundle directory |
| 62 | - Generate SHA256 manifest |
| 63 | - Produce a `.zip` artifact |
| 64 | |
| 65 | ### 5) Optional VC++ Redistributable Inclusion |
| 66 | |
| 67 | If your distribution policy requires bundling the VC++ runtime installer, provide it to the script: |
| 68 | |
| 69 | ```bash |
| 70 | bash ./skills/windows-flutter-exe/scripts/build_windows_flutter_bundle.sh \ |
| 71 | --app-root <APP_ROOT> \ |
| 72 | --out-dir <OUTPUT_DIR> \ |
| 73 | --vc-redist-path <PATH_TO_VC_REDIST_X64_EXE> |
| 74 | ``` |
| 75 | |
| 76 | ### 6) Clean-Machine Validation (Release Gate) |
| 77 | |
| 78 | - Test the packaged bundle on a clean Windows machine/VM. |
| 79 | - Confirm app launch without missing DLL errors. |
| 80 | - Confirm plugin features that depend on native libraries. |
| 81 | |
| 82 | ## Troubleshooting |
| 83 | |
| 84 | - `Missing flutter_windows.dll`: |
| 85 | package entire `Release` directory, not exe-only. |
| 86 | - `MSVCP140.dll` or `VCRUNTIME140.dll` errors: |
| 87 | install or ship Microsoft Visual C++ Redistributable (x64). |
| 88 | - App runs locally but not on user machine: |
| 89 | validate on clean VM and compare bundle contents with CI artifact. |
| 90 | - Plugin feature fails in release only: |
| 91 | verify plugin DLLs are present in packaged bundle. |
| 92 | |
| 93 | ## Deliverables Checklist |
| 94 | |
| 95 | - [ ] `windows-x64/` folder containing exe + all dependencies |
| 96 | - [ ] `windows-x64.zip` archive |
| 97 | - [ ] `SHA256SUMS.txt` |
| 98 | - [ ] Optional `vc_redist.x64.exe` inside bundle (if policy requires) |