Skip to content

[package_info_plus] Wrong version on windows #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gutisalex opened this issue Jul 5, 2021 · 15 comments · Fixed by #2029
Closed

[package_info_plus] Wrong version on windows #343

gutisalex opened this issue Jul 5, 2021 · 15 comments · Fixed by #2029
Labels
bug Something isn't working Hacktoberfest Issues taking part in Hacktoberfest package_info_plus stuff related to package_info_plus

Comments

@gutisalex
Copy link

Hey,

Steps to reproduce:
I've set the version to 1.0.22+22 in pubspec yaml...

I use a function to get the version:

Future<String> getAppVersion() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    return packageInfo.version;
  }

Result:
On Android I am getting 1.0.2
On Windows I am getting 1.0.0

Expected:
On Windows it should also be 1.0.2

@gutisalex gutisalex added the bug Something isn't working label Jul 5, 2021
@mhadaily mhadaily added the package_info_plus stuff related to package_info_plus label Jul 6, 2021
@mhadaily
Copy link
Member

mhadaily commented Jul 6, 2021

@jpnurmi do you have any idea for this?

@jpnurmi
Copy link
Member

jpnurmi commented Jul 6, 2021

I recall it's the version of the .exe, which should be possible to define with CMake.

@stuartmorgan-g
Copy link

I've set the version to 1.0.22+22 in pubspec yaml

This doesn't currently do anything for Windows builds; see flutter/flutter#73652

@mhadaily mhadaily added the Hacktoberfest Issues taking part in Hacktoberfest label Sep 28, 2021
@sgsm74
Copy link

sgsm74 commented Dec 6, 2021

same issue, any solution?

@Eerey
Copy link

Eerey commented Apr 12, 2022

Same here for windows

@stuartmorgan-g
Copy link

Everyone will have this behavior on Windows because, per my comment above, that's how Flutter currently works. The version in pubspec.yaml has no impact on the Windows executable you get from flutter build, you have to change the version in Runner.rc.

@chitgoks
Copy link

Is this the same reason for the version now? 1.4.2. Instead of the value 1.0.2 i get 1 only. no decimal. (in windows)

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

@github-actions github-actions bot added Stale and removed Stale labels Jun 23, 2022
@ismanong
Copy link

The newest ones are already supported and can get the version number correctly

@lgLindstrom
Copy link

I have a old windows project where this problem occur. Duplication the example project in package_info_plus works okay, but not my old project. This leads me to believe that I must update something in my project.
What ???

@he0119
Copy link

he0119 commented Oct 13, 2022

I have a old windows project where this problem occur. Duplication the example project in package_info_plus works okay, but not my old project. This leads me to believe that I must update something in my project. What ???

Here is the migration guide for you.

Flutter 3.3 added support for setting the Windows app’s version from the pubspec.yaml file or through the --build-name and --build-number build arguments. For more information, refer to the Build and release a Windows app documentation.

Projects created before Flutter version 3.3 need to be migrated to support versioning.

@neoDD69
Copy link

neoDD69 commented Dec 22, 2022

IMHO, and after few test, the problem IS NOT an issue of thi package [package_info_plus] , but the COMPILER used by Flutter.

If you see the details of the .exe with "Windows Explorer", you will see the same number that the [package_info_plus] return.
image
image

If you search you will found a lot of thread about the version of Flutter-Windows app and all talk about a runnner.rc

@Levi-Lesches
Copy link

Levi-Lesches commented Mar 14, 2023

This is fixed now that flutter/flutter#73652 has been fixed, but you'll need to migrate your project by following the instructions here for projects created before Flutter 3.3

@bksubhuti
Copy link

I was about to leave an issue.. but I also had the same problem. If you had started a project before Flutter 3.3, then your Windows build will be "stale" and not work with this package "as expected" Getting the version and build from the yaml. You will be saying "It works in Android, but not in Windows."
It would be good to document this issue in the package info readme to tell people to upgrade the windows build..

To solve this problem
Delete the windows directory of your project and do the flutter create again.
flutter create --platforms=windows .

You can see this link here
https://docs.flutter.dev/platform-integration/windows/version-migration

After doing this, you will then be able to get the desired results.

In any case.. I appreciate this package very much and we ship to 5 Os's. We have a project that was started a while back and had trouble with determining version numbers because we hardcoded it.. and we are lazy to change every time. However, the build number increments are required for app store submission, so we cannot be lazy with that.

It might just be that older projects that started the flutter create with windows only one year ago will be looking for this package_info addon as a solution, yet encounter these same errors.
I also suggest a way to place issues a little easier. I did a few things and then realized I would have to compile the example program first.. so I lost my writing and gave up. Compiling the given example program would probably still give me an error, because I often have a project used for compiling sample programs. And if my stub was old enough, that would be an older windows setup.

@vbuberen
Copy link
Collaborator

vbuberen commented Aug 5, 2023

@bksubhuti Thank you very much for such detailed feedback. I will update the documentation to explicitly mention requirement to migrate.

J-Pabon added a commit to equalitie/ouisync-app that referenced this issue Jan 26, 2024
This was a known issue with projects created up to Flutter 3.3

Fix suggested in the issue on plus_plugins repo: fluttercommunity/plus_plugins#343 (comment)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Hacktoberfest Issues taking part in Hacktoberfest package_info_plus stuff related to package_info_plus
Projects
None yet
Development

Successfully merging a pull request may close this issue.