The content of the file GitVersion_WixVersion.wxi is not fully overwritten/recreated when the file already exists and GitVersion /updatewixversionfile is invoked. Instead it just overwrites the first x bytes.
The entire content of GitVersion_WixVersion.wxi is overwritten and the file has a valid content afterwards.
If the existing file is larger than the newly generated file, parts of the previously existing content remain in the file.
Delete the file prior writing/correctly write the content.
GitVersion_WixVersion.wxiin the root of a repo.GitVersion /updatewixversionfile<?xml version="1.0" encoding="utf-8"?>
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define AssemblySemFileVer="2.0.0.0"?>
<?define AssemblySemVer="2.0.0.0"?>
...
<?define WeightedPreReleaseNumber="30001"?>
</Include>ignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
I don't use Wix myself, so I don't know where to start looking to fix this. Would you be up for having a look yourself and possibly submitting a PR, @tcs-devel?
@tcs-devel at the time we added wix support via #1599 it was not specified how exaclty it should work, but the idea was to update, as we have with assemblyinfo, not to re-create.
You can check the implementation here https://github.com/GitTools/GitVersion/blob/master/src/GitVersionCore/VersionConverters/WixUpdater/WixVersionFileUpdater.cs#L27-L40. In case the current implementation is not the way you think it should we can discuss
@asbjornu: Using wix itself is not required. It can easily be reproduced without wix. Just create a file GitVersion_WixVersion.wxi in the root of a repo which is larger than the file that will be created by calling GitVersion /updatewixversionfile. You will see that afterwards the content of the file GitVersion_WixVersion.wxi starts with the generated content followed by parts of the previous content.
The issue is, that WixVersionFileUpdater uses OpenWrite(...)
https://github.com/GitTools/GitVersion/blob/438d45004092e2f6b9aa4d12b07c64becfff4031/src/GitVersionCore/VersionConverters/WixUpdater/WixVersionFileUpdater.cs#L38
see the behavior as documented e.g. in
https://docs.microsoft.com/en-us/dotnet/api/system.io.file.openwrite?view=netcore-3.1
I added some changes in #2259
:tada: This issue has been resolved in version 5.3.3 :tada:
The release is available on:
Your GitReleaseManager bot :package::rocket:
Most helpful comment
@asbjornu: Using wix itself is not required. It can easily be reproduced without wix. Just create a file
GitVersion_WixVersion.wxiin the root of a repo which is larger than the file that will be created by callingGitVersion /updatewixversionfile. You will see that afterwards the content of the fileGitVersion_WixVersion.wxistarts with the generated content followed by parts of the previous content.The issue is, that
WixVersionFileUpdaterusesOpenWrite(...)https://github.com/GitTools/GitVersion/blob/438d45004092e2f6b9aa4d12b07c64becfff4031/src/GitVersionCore/VersionConverters/WixUpdater/WixVersionFileUpdater.cs#L38
see the behavior as documented e.g. in
https://docs.microsoft.com/en-us/dotnet/api/system.io.file.openwrite?view=netcore-3.1
I added some changes in #2259