Closed junlinz2 closed 1 month ago
You're using version 5.12, can you also try version 6.0.0-rc.2 and see it it reproduces?
Thanks for your response. I updated my MSBuild tool to 6.0.0-rc.2, when I attempt to build using the same build commands I get a build failure when it attempts to build for the net8.0-ios
target framework. The build works with the net8.0
target framework (the first one defined in my csproj).:
"/Users/xyz/Desktop/gv-testing/gv-proj.csproj" (Rebuild target) (1:15) ->
"/Users/xyz/Desktop/gv-testing/gv-proj.csproj" (Build target) (1:19) ->
(RunGitVersion target) ->
/Users/xyz/.nuget/packages/gitversion.msbuild/6.0.0-rc.2/tools/GitVersion.MsBuild.targets(21,9): error MSB3073: The command "dotnet --roll-forward Major "/Users/xyz/.nuget/packages/gitversion.msbuild/6.0.0-rc.2/tools/net8.0-ios/gitversion.dll" "/Users/xyz/Desktop/gv-testing" -output file -outputfile "obj/gitversion.json"" exited with code 1. [/Users/xyz/Desktop/gv-testing/gv-proj.csproj::TargetFramework=net8.0-ios]
1 Warning(s)
1 Error(s)
This seems to be because the command it's trying to run references a gitversion.dll that does not exist:
% dotnet --roll-forward Major "/Users/xyz/.nuget/packages/gitversion.msbuild/6.0.0-rc.2/tools/net8.0-ios/gitversion.dll" "/Users/xyz/Desktop/gv-testing" -output file -outputfile "obj/gitversion.json"
Could not execute because the specified command or file was not found.
....
% ls $HOME/.nuget/packages/gitversion.msbuild/6.0.0-rc.2/tools
GitVersion.MsBuild.props GitVersion.MsBuild.targets net6.0 net7.0 net8.0
:tada: This issue has been resolved in version 6.0.1 :tada: The release is available on:
Your GitReleaseManager bot :package::rocket:
Prerequisites
GitVersion package
GitVersion.MsBuild
GitVersion version
5.12
Operating system
Windows, macOS
What are you seeing?
When running .NET builds in a Jenkins environment, the gitversion.properties file is re-written to multiple times, according to how many target frameworks are specified. I believe it should only be written to once as my impression is that GitVersion information is unique to the Git repo overall, and not specific to the target framework being built.
This might be the cause of the issue https://github.com/GitTools/GitVersion/issues/3737 that I previously found as Windows is much more restrictive with files being written to concurrently. To address the concerns in https://github.com/GitTools/GitVersion/issues/3737#issuecomment-1878368944 and to add some info on our setup:
What is expected?
gitversion.properties file should only be written to once, regardless of how many
TargetFrameworks
there are. So if this file did not exist (which should be the case with a clean build anyway), any concurrency that .NET might have with building the project for multiple target frameworks should not cause the build to fail due to repeated attempts to write to the same file.If GitVersion information did somehow differ between target frameworks, the build process should write different properties files to avoid the possibility of this information being overwritten by the next target framework build.
Steps to Reproduce
Tested this issue on macOS to utilise the
tail -f
command, however in Windows build log it is also evident when using-v: normal
that the gitversion.properties file is written to more than once.Result:
1>WriteVersionInfoToBuildLog
is performed twice. In the window where gitversion.properties is being tailed, the gitversion variables are printed twice, indicating that this file has been overwritten during the build process.RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).