maui icon indicating copy to clipboard operation
maui copied to clipboard

Windows Appxmanifest version info not updating when csproj version info is updated

Open SmartmanApps opened this issue 2 years ago • 4 comments

Description

New issue that the Windows AppXmanifest is no longer updating the version info when the version info in the csproj is updated. Android version info still working correctly (haven't tested other platforms). System reflection retrieves the correct info, but the Appxmanifest info appears to be hard-saved somewhere and overrides it.

Steps to Reproduce

  1. create a Maui app.
  2. update the version info in the csproj
  3. observe that the Windows version info has NOT been updated.

In the repro, the master branch shows both Windows and Android showing V1, then the Version2 branch the csproj has been updated and Android shows V2 but Windows still shows V1 (via AppInfo, but system reflection shows V2), because appxmanifest still on V1 (even after deleting bin and obj folders, clean, rebuilds the works! It's hard-coded in somewhere now where it wasn't before).

note: this has happened since I updated VS from 17.5.1 to 17.5.5 - I haven't changed my dotnet version in that time (unless the VS update changed it?).

Link to public reproduction project repository

https://github.com/SmartmanApps/WinManifestRepro.App

Version with bug

7.0 (current)

Last version that worked well

7.0 (current)

Affected platforms

Windows

Affected platform versions

1000.19041.1000.0

Did you find any workaround?

Use system reflection instead of AppInfo, and/or directly update the appxmanifest (which means having to update version info in 2 places every time you change the version number - previously only had to update in 1 place).

Relevant log output

No response

SmartmanApps avatar May 14 '23 04:05 SmartmanApps

I have some more information to add on this. I just had to re-clone one of my apps. I changed the version number in the csproj same as before, which in this case was from 0.3.0 to 0.3.1 (the version I had backed out of and now needed to redo). Again Android showed the updated version number, and Windows did not. HOWEVER this time when I went into the appxmanifest, it WASN'T displaying 0.3.0, but 0.0.0! Odd. So I went through my normal procedure of deleting bin/obj directories, clean, rebuild, and when I was done I didn't get 0.3.0 as expected (due to bug), but 0,3.1!

So my first thought was the bug has disappeared! But then I thought about it and realised that, for this re-cloning, this was the first time the version number had changed, and perhaps what is getting hard-coded in somewhere (still don't know where) is this first version number change, and so I suspect what will happen NEXT time I want to change the version number (to either 0.3.2 or 0.4.0 as the case may be) it will stay stuck on 0.3.1, but that's just a theory at the moment.

Actually, I just went back and checked and appxmanifest is still displaying 0.0.0, so I'm getting different behaviour in different apps somehow. Hopefully you can see what is going on from the repro.

SmartmanApps avatar May 16 '23 10:05 SmartmanApps

Hello. I'm on VS 17.7.3 now, and the behaviour has changed again!

Previously a clean and rebuild (sometimes needing to delete bin and obj folders first) would get the Windows version number updated , however that is no longer working. The new behaviour (which is interesting after reading my previous comment) is that when I update the csproj to 0.4.1, the Package.appxmanifest is still reading 0.4.0 (i.e. isn't getting updated when I update the csproj), but when I manually update the appxmanifest it works! i.e. I have to update the number in 2 different places now.

SmartmanApps avatar Sep 13 '23 06:09 SmartmanApps

Good to know it is intended to auto update. For me that never happened from the start and I did not understand why I have to set the version number in multiple places. As I am only building for windows atm I just set the one version in the appxmanifest manually.

Are the other redundant values like the package name etc. also supposed to automatically propagate from the csproj file?

Peaj avatar Oct 31 '23 15:10 Peaj

Verified this issue with Visual Studio Enterprise 17.9.0 Preview 2.1. Can repro on windows platforms with sample project. https://github.com/SmartmanApps/WinManifestRepro.App image

homeyf avatar Jan 12 '24 09:01 homeyf