Skip to content

Commit

Permalink
Merge pull request #4206 from samtrion/main
Browse files Browse the repository at this point in the history
Normalization of GitVersionTargetFramework and fallback scenario
  • Loading branch information
arturcic authored Oct 31, 2024
2 parents d2954bc + b389378 commit bcb4f55
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
<UpdateAssemblyInfo Condition=" '$(UpdateAssemblyInfo)' == 'true' And '$(GenerateGitVersionFiles)' == 'true' ">true</UpdateAssemblyInfo>
<GenerateGitVersionInformation Condition=" '$(GenerateGitVersionInformation)' == '' And '$(GenerateGitVersionFiles)' == 'true' ">true</GenerateGitVersionInformation>

<GitVersionTargetFramework Condition="'$(GitVersionTargetFramework)' == ''">$(TargetFramework)</GitVersionTargetFramework>
<!-- Validates the target framework and sets the GitVersionTargetFramework property to the target framework that is compatible with the target framework of the project -->
<GitVersionTargetFramework Condition="'$(GitVersionTargetFramework)' == '' and $([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net8.0')) == 'true'">net8.0</GitVersionTargetFramework>
<GitVersionTargetFramework Condition="'$(GitVersionTargetFramework)' == '' and $([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net6.0')) == 'true'">net6.0</GitVersionTargetFramework>
<!-- Fall back to net8.0 if the target framework is not compatible with net6.0 and net8.0 -->
<GitVersionTargetFramework Condition="'$(GitVersionTargetFramework)' == ''">net8.0</GitVersionTargetFramework>
<GitVersionFileExe Condition="'$(GitVersionFileExe)' == ''">dotnet --roll-forward Major &quot;$([MSBuild]::EnsureTrailingSlash($(MSBuildThisFileDirectory)$(GitVersionTargetFramework)))gitversion.dll&quot;</GitVersionFileExe>
<GitVersionAssemblyFile Condition="'$(GitVersionAssemblyFile)' == ''">$([MSBuild]::EnsureTrailingSlash($(MSBuildThisFileDirectory)$(GitVersionTargetFramework)))GitVersion.MsBuild.dll</GitVersionAssemblyFile>
</PropertyGroup>
Expand Down

0 comments on commit bcb4f55

Please sign in to comment.