Skip to content
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

[ISSUE]: gitversion.msbuild v6.0.1 breaks build #4140

Closed
2 tasks done
luis-fss opened this issue Aug 5, 2024 · 7 comments · Fixed by #4142
Closed
2 tasks done

[ISSUE]: gitversion.msbuild v6.0.1 breaks build #4140

luis-fss opened this issue Aug 5, 2024 · 7 comments · Fixed by #4142
Labels
Milestone

Comments

@luis-fss
Copy link

luis-fss commented Aug 5, 2024

Prerequisites

  • I have searched issues to ensure it has not already been reported
  • I have written a descriptive issue title

GitVersion package

GitVersion.MsBuild

GitVersion version

gitversion.msbuild v6.0.1

Operating system

Windows

What are you seeing?

dotnet build is falling.

What is expected?

A build success.

Steps to Reproduce

Just upgrade from gitversion.msbuild v6.0.0 to v6.0.1 and try dotnet build
The TargetFramework is net8.0

RepositoryFixture Test

none

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

none
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\Luis\.nuget\packages\gitversion.msbuild\6.0.1\tools\GitVersion.MsBuild.targets(18,9): error MSB3073: The command "dotnet --roll-forward Major "C:\Users\Luis\.nuget\packages\gitversion.msbuild\6.0.1\tools\gitversion.dll" "C:\Us
ers\Luis\source\repos\PMCM.Web\src\PMCM.BlazorApp"  -output file -outputfile "obj\gitversion.json"" exited with code 1. [C:\Users\Luis\source\repos\PMCM.Web\src\PMCM.BlazorApp\PMCM.BlazorApp.csproj]
@arturcic
Copy link
Member

arturcic commented Aug 5, 2024

Please post here the csproj file, just remove the not relevant parts

@luis-fss
Copy link
Author

luis-fss commented Aug 5, 2024

Sure, here is the entire thing:

<Project Sdk="Microsoft.NET.Sdk.Web">

    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <Nullable>enable</Nullable>
        <ImplicitUsings>enable</ImplicitUsings>
        <UserSecretsId>aspnet-PMCM.BlazorApp-BC9E0918-B82F-462E-9A88-553DA00F706E</UserSecretsId>
        <RootNamespace>PMCM.BlazorApp</RootNamespace>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="AspNetCore.SassCompiler" Version="1.77.8">
            <PrivateAssets>all</PrivateAssets>
        </PackageReference>
        <PackageReference Include="AsyncAwaitBestPractices" Version="8.0.0" />
        <PackageReference Include="Ben.Demystifier" Version="0.4.1" />
        <PackageReference Include="BitzArt.Blazor.Auth.Server" Version="1.0.0" />
        <PackageReference Include="Blazored.FluentValidation" Version="2.2.0" />
        <PackageReference Include="Blazored.Toast" Version="4.2.1" />
        <PackageReference Include="ByteSize" Version="2.1.2" />
        <PackageReference Include="csvhelper" Version="33.0.1" />
        <PackageReference Include="Exceptionless.AspNetCore" Version="6.0.4" />
        <PackageReference Include="Extensions.FluentValidation.Br" Version="1.0.2" />
        <PackageReference Include="GitVersion.MsBuild" Version="6.0.1">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
        <PackageReference Include="Humanizer.Core.pt" Version="2.14.1" />
        <PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
        <PackageReference Include="Microcharts" Version="0.9.5.9" />
        <PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
        <PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.175" />
        <PackageReference Include="MediatR" Version="12.4.0" />
        <PackageReference Include="MudBlazor" Version="7.5.0" />
        <PackageReference Include="NodaTime" Version="3.1.11" />
        <PackageReference Include="QuestPDF" Version="2024.7.2" />
        <PackageReference Include="RavenDB.Client" Version="6.0.105" />
        <PackageReference Include="Rollbar" Version="5.2.2" />
        <PackageReference Include="SendGrid" Version="9.29.3" />
        <PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.1.1" />
        <PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
        <PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
        <PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
        <PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
        <PackageReference Include="Serilog.Settings.Configuration" Version="8.0.2" />
        <PackageReference Include="Serilog.Sinks.Exceptionless" Version="5.0.0" />
        <PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
        <PackageReference Include="Serilog.Sinks.Loggly" Version="5.4.0" />
        <PackageReference Include="Serilog.Sinks.RavenDB" Version="3.0.0" />
        <PackageReference Include="Serilog.Sinks.RollbarCom" Version="1.0.4" />
        <PackageReference Include="TypeMember" Version="1.0.0" />
        <PackageReference Include="SkiaSharp" Version="2.88.8" Condition="$(RuntimeIdentifier.Contains('win-x')) == false" />
        <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.8" Condition="$(RuntimeIdentifier.Contains('win-x')) == false" />
        <PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="7.3.0.2" Condition="$(RuntimeIdentifier.Contains('win-x')) == false" />
    </ItemGroup>

    <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
        <Exec Command="echo OS: $(OS)" />
        <Exec Command="echo RuntimeIdentifier: $(RuntimeIdentifier)" />
        <Exec Command="echo Publish Linux runtime dependencies: $(RuntimeIdentifier.StartsWith('win-x').Equals(False))" />
        <Exec Command="echo;" />
    </Target>

    <Target Name="QuestPDF_DoNotIncludeLatoFont_AfterBuild" AfterTargets="Build">
        <RemoveDir Directories="$(OutDir)/LatoFont" />
    </Target>

    <Target Name="QuestPDF_DoNotIncludeLatoFont_AfterPublish" AfterTargets="Publish">
        <RemoveDir Directories="$(PublishDir)/LatoFont" />
    </Target>

    <ItemGroup>
      <None Update="Core\Certificate\db.pfx">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      </None>
    </ItemGroup>

    <ItemGroup>
        <Folder Include="Core\Certificate\" />
        <Content Remove="Core\Logging\logs\**" />
        <Content Remove="wwwroot\lib\**" />
        <Folder Include="wwwroot\Upload\Logo\" />
        <Content Remove="wwwroot\Upload\Temp\**" />
        <Content Remove="wwwroot\Upload\Logo\custom-logo.png" />
        <None Update="Data\Certificate\db.pfx">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        <Content Include="wwwroot\lib\**\*.min.js">
            <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
        </Content>
        <Content Include="wwwroot\lib\**\*.min.css">
            <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
        </Content>
        <Content Include="wwwroot\lib\**\*.map">
            <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
        </Content>
        <Content Include="wwwroot\lib\**\*.woff">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Include="wwwroot\lib\**\*.woff2">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Remove="wwwroot\lib\\bootstrap\dist\css\*.rtl.*" />
    </ItemGroup>

    <ItemGroup>
      <ProjectReference Include="..\RavenDB.Identity\RavenDB.Identity.csproj" />
    </ItemGroup>

    <ItemGroup>
      <_ContentIncludedByDefault Remove="Core\Logging\logs\buffer-20240619.json" />
    </ItemGroup>

</Project>

@hazzik
Copy link

hazzik commented Aug 5, 2024

Same here.

/home/runner/.nuget/packages/gitversion.msbuild/6.0.1/tools/GitVersion.MsBuild.targets(18,9): error MSB3073: The command "dotnet --roll-forward Major "/home/runner/.nuget/packages/gitversion.msbuild/6.0.1/tools/gitversion.dll" "/home/runner/work/NHibernate.DuckDB/NHibernate.DuckDB/src/NHibernate.DuckDB" -output file -outputfile "obj/gitversion.json"" exited with code 1. [/home/runner/work/NHibernate.DuckDB/NHibernate.DuckDB/src/NHibernate.DuckDB/NHibernate.DuckDB.csproj]

The Directory.Build.props file: https://github.com/hazzik/NHibernate.DuckDB/blob/33c577cd97b79ee23d88750b88661390c4fd40cf/src/Directory.Build.props

Also, it was failing in 6.0.0 as well.

@jschwitalla
Copy link

Same with us. But it was related to our global.json in projects which had pinned the dotnet version to latestFeature instead of latestMajor which would have allowed this operation to succeed.

{ "sdk": { "version": "8.0.100", "rollForward": "latestFeature" } }

@Louis9902
Copy link

from my testing the problem seems to be that the targetframework specifier is missing from the dll path. In my case the command that is executed is dotnet --roll-forward Major "C:\Users\seubert\.nuget\packages\gitversion.msbuild\6.0.1\tools\gitversion.dll" "<project>" -output file -outputfile "<project>\gitversion.json". The path C:\Users\seubert\.nuget\packages\gitversion.msbuild\6.0.1\tools\gitversion.dll does not point to a dll because the target framework is missing.

This might be caused by #4093 because there the TargetFramework is made overrideable. But this will cause problems because of the evaluation order in which the props/targets are evaluated. This is because the <TargetFramework> might be null at the evaluation time of the src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.props because it is set later in the evaluation chain of the sdk.

@arturcic
Copy link
Member

arturcic commented Aug 6, 2024

@Louis9902 good catch, I think when I moved the props to the .props file I forgot about this nuance

@arturcic arturcic linked a pull request Aug 6, 2024 that will close this issue
5 tasks
@arturcic arturcic added this to the 6.x milestone Aug 6, 2024
@arturcic arturcic added bug and removed needs triage labels Aug 6, 2024
@arturcic arturcic modified the milestones: 6.x, 6.0.2 Aug 12, 2024
@arturcic
Copy link
Member

🎉 This issue has been resolved in version 6.0.2 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants