After updating WinForms desktop application, Setup project uninstall successfully deletes installation path by C:Program Files (x86)myProject, but new, in advance Clean, Rebuild and Build installation executes the previous version of the code, which was actual at the time of adding Setup project to solution.
What I have to do:
In Configuration manager from Build menu and column check "main Project" and the "Setup project" for both "Debug" and "Release" versions.
In Solution Explorer my project properties Application tab Assembly Information change the version of the project for both Assembly Version and File Version with same versioning values.
Change the version in the Setup project properties Version value with the same version.
I'm not sure if I've missed something to fix issue. Seems like correct way to not change version manually is auto increment of major, minor and patch versioning for Setup project, according this answers How to have an auto incrementing version number (Visual Studio)? and Can I automatically increment the file build version when using Visual Studio?
but if I'm doing this manually, if there is a 4 digits:
Assembly Version: 1, 0, 0, 0
File Version: 1, 0, 0, 0
and Setup project is a 3:
Version: 1, 0, 0
How set properly, if update is:
Assembly Version: 1, 0, 0, 1
File Version: 1, 0, 0, 1
Or if I should miss 4th digit, what will be correct for Configuration manager to avoid previous code with executable:
Assembly Version: 1, 0, 1, 0
File Version: 1, 0, 1, 0
and:
Version: 1, 0, 1
In my case with this task I found useful following links:
AssemblyVersionAttribute Class with AssemblyVersionAttribute(String) Constructor and in addition What are differences between AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion? with The specified version string contains wildcards, which are not compatible with determinism and How to: Specify build events (C#)
question from:
https://stackoverflow.com/questions/66067879/winforms-setup-project-installation-executes-the-previous-version