Skip to content

[ISSUE]: GitVersion.MsBuild - GitVersion.MsBuild.targets and GitVersion.MsBuild.props: Error MSB3073 (gitversion.dll not found) in Version 6.0.1 #4148

Closed
@ps-pe

Description

@ps-pe

Prerequisites

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

GitVersion package

GitVersion.MsBuild

GitVersion version

6.0.1

Operating system

Windows

What are you seeing?

MS Build error:

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\user\.nuget\packages\gitversion.msbuild\6.0.1\tools\GitVersion.MsBuild.targets(18,9): error MSB3073: The command "dotnet --roll-forward Major "C:\Users\user\.nuget\packages\gitversion.msbuild\6.0.1\tools\gitversion.dll" "C:\Projects\a\b\c"  -output file -outputfile "obj\gitversion.json"" exited with code 1. [C:\Projects\a\b\c\Project.csproj]

What is expected?

The path to gitversion.dll should be resolved to:

C:\Users\user\.nuget\packages\gitversion.msbuild\6.0.1\tools\net8.0\gitversion.dll

Steps to Reproduce

  1. Create an empty C# project (e.g. minimal Hello World console app):
<Project Sdk="Microsoft.NET.Sdk.Web">

  <ItemGroup>
    <PackageReference Include="GitVersion.MsBuild" Version="6.0.1">
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <!-- that doesn't work either:  -->
    <!-- <GitVersionTargetFramework>net8.0</GitVersionTargetFramework> -->
  </PropertyGroup>

</Project>
  1. Create GIT repo and build the Project (using dotnet CLI):
    dotnet build

  2. Error

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\user\.nuget\packages\gitversion.msbuild\6.0.1\tools\GitVersion.MsBuild.targets(18,9): error MSB3073: The command "dotnet --roll-forward Major "C:\Users\user\.nuget\packages\gitversion.msbuild\6.0.1\tools\gitversion.dll" "C:\Projects\a\b\c"  -output file -outputfile "obj\gitversion.json"" exited with code 1. [C:\Projects\a\b\c\Project.csproj]`

Notes:
The TargetFramework property is not defined at this point of time and should be moved to GitVersion.MsBuild.targets instead.
https://github.com/GitTools/GitVersion/blob/6.0.1/src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.props#L20

Version 6.0.0 does work, version 6.0.1 does not work.

RepositoryFixture Test

No response

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions