GitTools / GitVersion

From git log to SemVer in no time
https://gitversion.net/docs/
MIT License
2.84k stars 650 forks source link

[ISSUE]: Build fails with .NET 8 and GitVersion.MsBuild 6.0.2 #4191

Closed aristotelos closed 3 weeks ago

aristotelos commented 3 weeks ago

Prerequisites

GitVersion package

GitVersion.MsBuild

GitVersion version

6.0.2

Operating system

Windows

What are you seeing?

Build fails after bumping GitVersion.MsBuild from 5.12.0 to 6.0.2. Build output:

Run dotnet build --no-restore --configuration $env:Configuration
  Possible reasons for this include:
    * You misspelled a built-in dotnet command.
    * You intended to execute a .NET program, but dotnet---roll-forward does not exist.
  Could not execute because the specified command or file was not found.
    * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
C:\Users\runneradmin\.nuget\packages\gitversion.msbuild\6.0.2\tools\GitVersion.MsBuild.targets(22,9): error MSB30[7](https://github.com/FlaUI/FlaUI.WebDriver/actions/runs/10612608289/job/29414614648?pr=68#step:5:8)3: The command "dotnet --roll-forward Major "C:\Users\runneradmin\.nuget\packages\gitversion.msbuild\6.0.2\tools\net[8](https://github.com/FlaUI/FlaUI.WebDriver/actions/runs/10612608289/job/29414614648?pr=68#step:5:9).0-windows\gitversion.dll" "D:\a\FlaUI.WebDriver\FlaUI.WebDriver\src\FlaUI.WebDriver"  -output file -outputfile "obj\gitversion.json"" exited with code 1. [D:\a\FlaUI.WebDriver\FlaUI.WebDriver\src\FlaUI.WebDriver\FlaUI.WebDriver.csproj]
  WpfApplication -> D:\a\FlaUI.WebDriver\FlaUI.WebDriver\src\TestApplications\WpfApplication\bin\Release\WpfApplication.dll

Build FAILED.

C:\Users\runneradmin\.nuget\packages\gitversion.msbuild\6.0.2\tools\GitVersion.MsBuild.targets(22,[9](https://github.com/FlaUI/FlaUI.WebDriver/actions/runs/10612608289/job/29414614648?pr=68#step:5:10)): error MSB3073: The command "dotnet --roll-forward Major "C:\Users\runneradmin\.nuget\packages\gitversion.msbuild\6.0.2\tools\net8.0-windows\gitversion.dll" "D:\a\FlaUI.WebDriver\FlaUI.WebDriver\src\FlaUI.WebDriver"  -output file -outputfile "obj\gitversion.json"" exited with code 1. [D:\a\FlaUI.WebDriver\FlaUI.WebDriver\src\FlaUI.WebDriver\FlaUI.WebDriver.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:14.83
Error: Process completed with exit code 1.

What is expected?

Build should succeed.

Steps to Reproduce

See https://github.com/FlaUI/FlaUI.WebDriver/pull/68 which has a failing build.

This may have to do with that my project has <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>?

RepositoryFixture Test

No response

Output log or link to your CI build (if appropriate).

See https://github.com/FlaUI/FlaUI.WebDriver/pull/68 which has a failing build.
arturcic commented 3 weeks ago

@aristotelos can you check this workaround https://github.com/GitTools/GitVersion/issues/4119?

aristotelos commented 3 weeks ago

@arturcic Using <GitVersionTargetFramework>net8.0</GitVersionTargetFramework> as workaround works. Is there no fix to be created by GitVersion to work without the <GitVersionTargetFramework> workaround? If so, could you point me to the open issue to follow?

arturcic commented 3 weeks ago

At this point the fix is not in place, mainly because we need to find a proper way to handle this especially for newer targets that will appear in the future

aristotelos commented 3 weeks ago

@arturcic But is there also no open issue to refer to and follow? Or should I create a new one?

arturcic commented 3 weeks ago

Please do

aristotelos commented 3 weeks ago

Created https://github.com/GitTools/GitVersion/issues/4192