Skip to content

Commit 0c49e02

Browse files
committed
Merged PR 117: Add changes for 1.0.3 release
Add changes for 1.0.3 release
2 parents 9606c51 + 1b2e0cc commit 0c49e02

File tree

6 files changed

+37
-14
lines changed

6 files changed

+37
-14
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# CHANGELOG
2+
## 1.0.3
3+
4+
### Bug Fixes
5+
- Bug fix for null package version in `Install-PSResource`
6+
27
## 1.0.2
38

49
### Bug Fixes

src/Microsoft.PowerShell.PSResourceGet.psd1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@{
55
RootModule = './Microsoft.PowerShell.PSResourceGet.dll'
66
NestedModules = @('./Microsoft.PowerShell.PSResourceGet.psm1')
7-
ModuleVersion = '1.0.2'
7+
ModuleVersion = '1.0.3'
88
CompatiblePSEditions = @('Core', 'Desktop')
99
GUID = 'e4e0bda1-0703-44a5-b70d-8fe704cd0643'
1010
Author = 'Microsoft Corporation'
@@ -55,6 +55,11 @@
5555
ProjectUri = 'https://go.microsoft.com/fwlink/?LinkId=828955'
5656
LicenseUri = 'https://go.microsoft.com/fwlink/?LinkId=829061'
5757
ReleaseNotes = @'
58+
## 1.0.3
59+
60+
### Bug Fixes
61+
- Bug fix for null package version in `Install-PSResource`
62+
5863
## 1.0.2
5964
6065
### Bug Fixes

src/code/InstallHelper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,10 @@ private Hashtable BeginPackageInstall(
790790

791791
pkgToInstall.RepositorySourceLocation = repository.Uri.ToString();
792792
pkgToInstall.AdditionalMetadata.TryGetValue("NormalizedVersion", out string pkgVersion);
793+
if (pkgVersion == null)
794+
{
795+
pkgVersion = pkgToInstall.Version.ToString();
796+
}
793797

794798
// Check to see if the pkg is already installed (ie the pkg is installed and the version satisfies the version range provided via param)
795799
if (!_reinstall)

src/code/Microsoft.PowerShell.PSResourceGet.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<OutputType>Library</OutputType>
66
<RootNamespace>Microsoft.PowerShell.PSResourceGet</RootNamespace>
77
<AssemblyName>Microsoft.PowerShell.PSResourceGet</AssemblyName>
8-
<AssemblyVersion>1.0.2.0</AssemblyVersion>
9-
<FileVersion>1.0.2</FileVersion>
10-
<InformationalVersion>1.0.2</InformationalVersion>
8+
<AssemblyVersion>1.0.3.0</AssemblyVersion>
9+
<FileVersion>1.0.3</FileVersion>
10+
<InformationalVersion>1.0.3</InformationalVersion>
1111
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
1212
<LangVersion>9.0</LangVersion>
1313
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>

src/code/V2ServerAPICalls.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -677,13 +677,16 @@ public override Stream InstallPackage(string packageName, string packageVersion,
677677
Stream results = new MemoryStream();
678678
if (string.IsNullOrEmpty(packageVersion))
679679
{
680-
results = InstallName(packageName, out errRecord);
681-
}
682-
else
683-
{
684-
results = InstallVersion(packageName, packageVersion, out errRecord);
680+
errRecord = new ErrorRecord(
681+
exception: new ArgumentNullException($"Package version could not be found for {packageName}"),
682+
"PackageVersionNullOrEmptyError",
683+
ErrorCategory.InvalidArgument,
684+
_cmdletPassedIn);
685+
686+
return results;
685687
}
686688

689+
results = InstallVersion(packageName, packageVersion, out errRecord);
687690
return results;
688691
}
689692

src/code/V3ServerAPICalls.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ public override FindResults FindVersionWithTag(string packageName, string versio
285285

286286
/// <summary>
287287
/// Installs a specific package.
288+
/// User may request to install package with or without providing version (as seen in examples below), but prior to calling this method the package is located and package version determined.
289+
/// Therefore, package version should not be null in this method.
288290
/// Name: no wildcard support.
289291
/// Examples: Install "PowerShellGet"
290292
/// Install "PowerShellGet" -Version "3.0.0"
@@ -295,13 +297,17 @@ public override Stream InstallPackage(string packageName, string packageVersion,
295297
Stream results = new MemoryStream();
296298
if (string.IsNullOrEmpty(packageVersion))
297299
{
298-
results = InstallName(packageName, out errRecord);
299-
}
300-
else
301-
{
302-
results = InstallVersion(packageName, packageVersion, out errRecord);
300+
errRecord = new ErrorRecord(
301+
exception: new ArgumentNullException($"Package version could not be found for {packageName}"),
302+
"PackageVersionNullOrEmptyError",
303+
ErrorCategory.InvalidArgument,
304+
_cmdletPassedIn);
305+
306+
return results;
303307
}
304308

309+
results = InstallVersion(packageName, packageVersion, out errRecord);
310+
305311
return results;
306312
}
307313

0 commit comments

Comments
 (0)