Bugs in setting version

Aug 25, 2016 at 8:06 AM
Hi, Oleg!
I found 2 bugs:
  1. After project.SetVersionFrom(fileID)
    project.Version isn't changed, it's still 1.0.0.0
    After installing in programs and features version of program is right
  2. After project.SetVersionFromFile(file)
    file version is 5.2.30128.0
    project.Version is 5.2.3.0
Coordinator
Aug 26, 2016 at 12:49 AM
  1. It is an intended behavior. And the fact that after installing you see the correct version confirms that the feature works. SetVersionFrom isn't supposed to change the the project.Version instead it sets some special WiX instructions so WiX compiler extracts and assigns the version at compile time. The code documentation does reflect this behavior:
    Image
  2. Most likely the file you are specifying does have v5.2.3.0 or it has some inconsistency between AssemblyFile and Assembly version (see the documentation). A simple test (below) reveals that the feature works correctly:
    Image
Aug 29, 2016 at 9:17 AM
I use project.SetVersionFrom(fileID)
After the build Wix# prints out version 1.0.0.0, it's not right.
Coordinator
Aug 29, 2016 at 11:37 AM
Correct. Section #1 in my prev post explains why project.Version is not changed during the build.

If you use SetVersionFrom then Wix# is no longer responsible for setting the product version. This task is delegated to WiX so the whole project.Version value becomes completely irrelevant.

Just to improve the build output accuracy I changed the implementation to include clause about the value and the origin of the new overwritten version for the SetVersionFrom use-case.

If you eager to test it you can grab it from Git (<git>/src/WixSharp.Samples/WixSharp.dll).