-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] GitVersion.MsBuild does not set environment variables #2592
Comments
I think the root cause is this line in GitVersionTaskExecutor:
Previously in the old
It looks like the actual value was taken from GitVersion/src/GitVersionCore/VersionConverters/OutputGenerator/OutputGenerator.cs Line 35 in 26def75
So in the new if (writer == null || !updateBuildNumber)
{
return;
} From my point of view there are two issues:
Usage of updateBuildNumber in GitHubActionsI think skipping the creation of the if (writer == null)
{
return;
} Hardcode value in GitVersionTaskExecutorIt looks strange to me to use here a hard-coded value, but also the actual value is currently not available in What would be the right solution? |
Thanks for the digging, @ThomasPiskol! Are you able to reproduce the problem in a test and able to submit it as a pull request? |
Yes, I'm able to reproduce it in a test case and I have a fix for the GitHubActions issue. But I'm not sure how to properly fix the hard coded value in My current idea is to make it similar like What do you think @asbjornu? |
I think we need to change to make it consistent with the app |
Related to #2592 |
I have fixed #2592 but I'm stuck with the fix for #2552. public void WriteVersionInfoToBuildLog(WriteVersionInfoToBuildLog task)
{
versionVariables = VersionVariables.FromFile(task.VersionFile, fileSystem, log);
var configuration = configProvider.Provide(overrideConfig: options.Value.ConfigInfo.OverrideConfig);
gitVersionOutputTool.OutputVariables(versionVariables, configuration.UpdateBuildNumber ?? false);
} In order to use "LibGit2Sharp.NativeBinaries/2.0.312": {}, Due to this .NET Core expects the native libs to be present in the same folder like GitVersion.LibGit2Sharp.dll. I've verified this with Process Monitor: But the libs are actually located in the This can be reproduces with NUnit tests and with manual tests by using a locally created NuGet package. Previously in the old GitVersion.Task NuGet package (5.5.1) the "LibGit2Sharp.NativeBinaries/2.0.298": {
"runtimeTargets": {
"runtimes/alpine-x64/native/libgit2-ef5a385.so": {
"rid": "alpine-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
...
"runtimes/win-x64/native/git2-ef5a385.dll": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.28.0.0"
},
...
}
}, Currently I have no idea how to provide the correct path for the native libs. |
I've created a PR for this issue. Fixing the other issue #2552 is more complex. I'll discuss the possible solutions over there. |
🎉 This issue has been resolved in version 5.6.7 🎉 Your GitReleaseManager bot 📦🚀 |
Describe the bug
GitVersion.MsBuild
(5.6.6) does not create environment variables containing the version information calculated by GitVersion.Maybe this is related to #2552
Expected Behavior
The following environment variables were present after building a .NET Standard 2.0 library project with
dotnet build
usingGitVersionTask
(5.5.1):Actual Behavior
No
GitVersion_
environment variables are present whenGitVersion.MsBuild
(5.6.6) is used.Steps to Reproduce
GitVersion.MsBuild
:dotnet build
Context
The environment variables should be set also by
GitVersion.MsBuild
. It's quite common in a CI pipeline to use the calculated version for some other tasks.In this case a GitHub release should be created using the SemVer as the name of the release and as the value for tag.
Your Environment
GitVersion.MsBuild
(5.6.6)The text was updated successfully, but these errors were encountered: