Skip to content

[ISSUE]: Version mismatch when using EnablePackageValidation #4429

Open
@MeikelLP

Description

@MeikelLP

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

5.12.0

Operating system

Linux

What are you seeing?

Successfully created package 'MyProject.1.27.0-branch.1.nupkg'.
/usr/share/dotnet/sdk/6.0.428/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Compatibility.Common.targets(33,5): error MSB4018: The "Microsoft.DotNet.Compatibility.ValidatePackage" task failed unexpectedly. [/MyApp/MyProject/MyProject.csproj]
/usr/share/dotnet/sdk/6.0.428/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Compatibility.Common.targets(33,5): error MSB4018: System.IO.InvalidDataException: The file is not a valid nupkg. File path: /MyApp/MyProject/bin/Release/MyProject.1.27.0-branch.1+34.nupkg [/MyApp/MyProject/MyProject.csproj]
/usr/share/dotnet/sdk/6.0.428/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Compatibility.Common.targets(33,5): error MSB4018:  ---> System.IO.FileNotFoundException: Could not find file '/MyApp/MyProject/bin/Release/MyProject.1.27.0-branch.1+34.nupkg'. [/MyApp/MyProject/MyProject.csproj]

The +34 is appended by the Microsoft.DotNet.Compatibility.ValidatePackage task. I don't know where it's pulling this info from

What is expected?

EnablePackageValidation should be able to verify the package correctly. I don't know if this is an sdk issue or GitVersion

The important difference is that msbuild uses the wrong version to find the current nuget package: MyProject.1.27.0-branch.1+34.nupkg but should be MyProject.1.27.0-branch.1.nupkg.

Steps to Reproduce

branch: feature/branch
csproj: set <EnablePackageValidation>true</EnablePackageValidation>
command: dotnet pack
runtime/sdk: net6.0 - due some company constraint I cannot upgrade yet

RepositoryFixture Test

No response

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions