Skip to content

Commit 8389b04

Browse files
Add prerelease string when NormalizedVersion doesn't exist (but prelease string does) (#1681)
1 parent d0e71b2 commit 8389b04

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/code/InstallHelper.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,12 @@ private Hashtable BeginPackageInstall(
803803
pkgToInstall.RepositorySourceLocation = repository.Uri.ToString();
804804
pkgToInstall.AdditionalMetadata.TryGetValue("NormalizedVersion", out string pkgVersion);
805805
if (pkgVersion == null) {
806+
// Not all NuGet providers (e.g. Artifactory, possibly others) send NormalizedVersion in NuGet package responses.
807+
// If they don't, we need to manually construct the combined version+prerelease from pkgToInstall.Version and the prerelease string.
806808
pkgVersion = pkgToInstall.Version.ToString();
809+
if (!String.IsNullOrEmpty(pkgToInstall.Prerelease)) {
810+
pkgVersion += $"-{pkgToInstall.Prerelease}";
811+
}
807812
}
808813
// Check to see if the pkg is already installed (ie the pkg is installed and the version satisfies the version range provided via param)
809814
if (!_reinstall)

0 commit comments

Comments
 (0)