YehudaKremer / msix

Create Msix installer for flutter windows-build files.
https://pub.dev/packages/msix
MIT License
273 stars 64 forks source link

[BUG] dart run msix:create no longer works with Flutter 3.16 #250

Closed jvanoeveren closed 7 months ago

jvanoeveren commented 7 months ago

:information_source: Info

Version: v3.16.6

:speech_balloon: Description

With the release of Flutter 3.16, the build output for Windows builds have changed to include the platform architecture in the build output. https://docs.flutter.dev/release/breaking-changes/windows-build-architecture So, when I run dart run msix:create, it will run flutter build windows and output the build in build/windows/x64/runner/Release. However, I then receive an error that the build files are not found at build/Windows/runner/Release because the platform architecture hasn't been appended to the file path yet.

Interestingly enough, if I run dart run msix:create, let it build the files, and then run dart run msix:create again, then it doesn't error and packages the msix correctly. I'm assuming that's a bug as it should work first try.

Here's the full verbose logs from running the command.

dart run msix:create -v
[     0.058s] parsing cli arguments
[     0.332s] validating config values
[     0.339s] pack files in build folder: C:\Users\user\Projects\flutter-app\build\windows\runner\Release
[     0.352s] running "flutter build windows"...
[     0.353s] build windows files with the command: "C:\Users\user\flutter\bin\flutter build windows"
[    22.243s] building msix files...
[    22.244s] validating build files
Unhandled exception:
Build files not found at C:\Users\user\Projects\flutter-app\build\windows\runner\Release, first run "flutter build windows" then try again
#0      Configuration.validateWindowsBuildFiles (package:msix/src/configuration.dart:363:7)
<asynchronous suspension>
#1      Msix._buildMsixFiles (package:msix/msix.dart:111:5)
<asynchronous suspension>
#2      Msix._createMsix (package:msix/msix.dart:102:5)
<asynchronous suspension>
#3      Msix.create (package:msix/msix.dart:59:5)
<asynchronous suspension>
#4      main (file:///C:/Users/user/AppData/Local/Pub/Cache/hosted/pub.dev/msix-3.16.6/bin/create.dart:4:3)
<asynchronous suspension>

:scroll: Pubspec.yaml

name: flutter_app
description: Flutter App
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.0.1

environment:
  sdk: '>=3.1.0 <4.0.0'

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.0
  msix: ^3.16.6

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

msix_config:
  display_name: Flutter App
  install_certificate: false
YehudaKremer commented 7 months ago

@jvanoeveren Thank you so much for this important bug report 🥇

I publish new version (3.16.7) with a fix.

Serohq commented 4 months ago

Hello, I ran into the same issue :

when I run dart run msix:create, it will run flutter build windows and output the build in build/windows/x64/runner/Release. However, I then receive an error that the build files are not found at build/Windows/runner/Release because the platform architecture hasn't been appended to the file path yet.

Built msix:create. running "flutter build windows"... 200.6s building msix files... /Unhandled exception: Build files not found at C:\xxxxxx/build/windows/runner/Release, first run "flutter build windows" then try again

0 Configuration.validateWindowsBuildFiles (package:msix/src/configuration.dart:258:7)

#1 Msix._buildMsixFiles (package:msix/msix.dart:107:5) #2 Msix._createMsix (package:msix/msix.dart:98:5) #3 Msix.create (package:msix/msix.dart:57:5) #4 main (file:///C:/Users/MYPC/AppData/Local/Pub/Cache/hosted/pub.dev/msix-3.7.0/bin/create.dart:4:3) But I am unable to upgrade to msix 3.16.7 due to below error: Resolving dependencies... (2.1s) Because msix >=3.16.4 depends on image ^4.0.9 and flutter_esc_pos_utils 0.1.8 depends on image ^3.1.3, msix >=3.16.4 is incompatible with flutter_esc_pos_utils 0.1.8. And because no versions of flutter_esc_pos_utils match >0.1.8 <0.2.0, msix >=3.16.4 is incompatible with flutter_esc_pos_utils ^0.1.8. And because flutter_esc_pos_network 1.0.2 depends on flutter_esc_pos_utils ^0.1.8 and no versions of flutter_esc_pos_network match >1.0.2 <2.0.0, msix >=3.16.4 is incompatible with flutter_esc_pos_network ^1.0.2. So, because XXXXXXX depends on both flutter_esc_pos_network ^1.0.2 and msix ^3.16.7, version solving failed. Basically I am stuck here and am unable to build the msix package. Could you please help me with an alternate solution how to build the msix package once the windows build command is completed. I really need help with this.