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

Don't take package metadata into account when computing nupkg filename. #15023

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ await PushNugetPackagesAsync(packagesToPublish, feedConfig, maxClients: MaxClien
async (feed, httpClient, package, feedAccount, feedVisibility, feedName) =>
{
string localPackagePath =
Path.Combine(PackageAssetsBasePath, $"{package.Id}.{package.Version}.nupkg");
Path.Combine(PackageAssetsBasePath, package.NuPkgFilename);
if (!File.Exists(localPackagePath))
{
Log.LogError($"Could not locate '{package.Id}.{package.Version}' at '{localPackagePath}'");
Expand Down Expand Up @@ -1210,7 +1210,7 @@ await Task.WhenAll(packagesToPublish.Select(async package =>
try
{
await clientThrottle.WaitAsync();
var packageFilename = $"{package.Id}.{package.Version}.nupkg";
var packageFilename = package.NuPkgFilename;
string temporaryPackageDirectory =
Path.GetFullPath(Path.Combine(ArtifactsBasePath, Guid.NewGuid().ToString()));
EnsureTemporaryDirectoryExists(temporaryPackageDirectory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Azure.Identity;
using Microsoft.Build.Framework;
using Microsoft.DotNet.Build.Tasks.Feed.Model;
using Microsoft.DotNet.VersionTools.BuildManifest.Model;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using System;
Expand Down Expand Up @@ -94,7 +95,7 @@ private async Task PushPackagesToFeed(string assetsFolder, string feedUrl)
await PushNugetPackagesAsync<PackageIdentity>(packagesToPublish, targetFeedConfig, 5,
async (feed, httpClient, package, feedAccount, feedVisibility, feedName) =>
{
string localPackagePath = Path.Combine(packagesFolder, $"{package.Id}.{package.Version}.nupkg");
string localPackagePath = Path.Combine(packagesFolder, PackageArtifactModel.GetNuPkgFileName(package.Id, package.Version.ToString ()));

if (!File.Exists(localPackagePath))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ public string OriginBuildName
set { Attributes[nameof(OriginBuildName)] = value; }
}

public string NuPkgFilename
{
get => GetNuPkgFileName(Id, Version);
}

public static string GetNuPkgFileName (string id, string version)
{
var metadataStart = version.IndexOf('+');
if (metadataStart >= 0)
version = version.Substring(0, metadataStart);
return $"{id}.{version}.nupkg";
}

public bool NonShipping
{
get
Expand Down
Loading