Skip to content

[ISSUE]: Version mismatch when using EnablePackageValidation #4429

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

Open
2 tasks done
MeikelLP opened this issue Feb 21, 2025 · 1 comment
Open
2 tasks done

[ISSUE]: Version mismatch when using EnablePackageValidation #4429

MeikelLP opened this issue Feb 21, 2025 · 1 comment

Comments

@MeikelLP
Copy link

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).

@MeikelLP
Copy link
Author

I assume it's happening here:
https://github.com/GitTools/GitVersion/blob/main/src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.targets#L67

Still I don't know why dotnet pack mismatches this with the real created file

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

No branches or pull requests

1 participant