From edb976d4529bc4541c56de056f651a6242d7e039 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Wed, 27 Jun 2018 14:15:56 -0700 Subject: [PATCH 1/7] Remove extraneous files from package Fixes se[arate issue discovered in #31 --- src/PowerShell/PowerShell.nuspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PowerShell/PowerShell.nuspec b/src/PowerShell/PowerShell.nuspec index 884e961..95e6567 100644 --- a/src/PowerShell/PowerShell.nuspec +++ b/src/PowerShell/PowerShell.nuspec @@ -52,7 +52,9 @@ - + + + From bcb58b0ff7e62674b4e6419ac178574d455ca2e0 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Mon, 5 Nov 2018 10:43:45 -0800 Subject: [PATCH 2/7] Complete support for .NET 3.5 (CLR 2.0) Fixes #34 --- inc/Common.props | 2 +- .../PowerShell/Commands/MeasureProductCommandTests.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/inc/Common.props b/inc/Common.props index b533de7..005fe81 100644 --- a/inc/Common.props +++ b/inc/Common.props @@ -5,7 +5,7 @@ AnyCPU Microsoft.Tools.WindowsInstaller.$(MSBuildProjectName) Microsoft.Tools.WindowsInstaller - v4.0 + v3.5 Properties 512 true diff --git a/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs index 17b3dbb..06fcdbb 100644 --- a/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs @@ -55,8 +55,8 @@ public void MeasureProductOnSystemDrive() } else { - Assert.IsTrue(0 == drive.GetPropertyValue("MSISpaceRequired")); - Assert.IsTrue(0 == drive.GetPropertyValue("MSITemporarySpaceRequired")); + Assert.AreEqual(0, drive.GetPropertyValue("MSISpaceRequired")); + Assert.AreEqual(0, drive.GetPropertyValue("MSITemporarySpaceRequired")); } } } @@ -91,8 +91,8 @@ public void MeasureProductOnOtherDrive() } else { - Assert.IsTrue(0 == drive.GetPropertyValue("MSISpaceRequired")); - Assert.IsTrue(0 == drive.GetPropertyValue("MSITemporarySpaceRequired")); + Assert.AreEqual(0, drive.GetPropertyValue("MSISpaceRequired")); + Assert.AreEqual(0, drive.GetPropertyValue("MSITemporarySpaceRequired")); } } } From 2b9a3e9ffcba74be97cc5c7b2b746be93c145d16 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Mon, 19 Nov 2018 19:25:56 -0800 Subject: [PATCH 3/7] Switch to Azure Pipelines --- appveyor.yml | 86 --------------------------------------------- azure-pipelines.yml | 65 ++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 86 deletions(-) delete mode 100644 appveyor.yml create mode 100644 azure-pipelines.yml diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b8f78f1..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,86 +0,0 @@ -configuration: - - Debug - - Release - -branches: - only: - - master - - develop - -environment: - RunCodeAnalysis: true - TreatWarningsAsErrors: true - -pull_requests: - do_not_increment_build_number: true -skip_tags: true - -notifications: -- provider: GitHubPullRequest - on_build_success: true - on_build_failure: true - -cache: - - packages -> **\packages.config - -install: - - ps: | - $ErrorActionPreference = 'Stop' - Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force - Install-Module -Name platyPS -Repository PSGallery -SkipPublisherCheck -Force - -before_build: - - nuget restore - - ps: New-ExternalHelp -Path $env:APPVEYOR_BUILD_FOLDER\docs -OutputPath $env:APPVEYOR_BUILD_FOLDER\src\PowerShell\bin\$env:CONFIGURATION -Force - -test: - assemblies: - - '**\bin\$(configuration)\*.test.dll' - -artifacts: - - path: src\PowerShell\bin\$(configuration) - name: msi # confusing name of zip default extraction directory - type: zip - - - path: src\PowerShell\bin\$(configuration)\*.nupkg - name: package - - - path: src\Setup\bin\$(configuration)\**\*.msi - name: installer - -deploy: - - provider: GitHub - description: 'Release version $(appveyor_build_version)' - auth_token: - secure: 7rtJ3qvAO3HF8g/FYpHHrVEZb+CzMNgEYquXzdsi7iNmZQwY7UreMh5mds3+9J4T - artifact: installer, package - on: - branch: master - configuration: Release - - - provider: GitHub - description: 'Prerelease version $(appveyor_build_version)' - prerelease: true - auth_token: - secure: 7rtJ3qvAO3HF8g/FYpHHrVEZb+CzMNgEYquXzdsi7iNmZQwY7UreMh5mds3+9J4T - artifact: installer, package - on: - branch: develop - configuration: Release - - - provider: NuGet - server: https://powershellgallery.com - api_key: - secure: 4STrzCp6wDsDBj/wCtmImMVL7wUI8DCGjdMBXGqQf9JZJ8LjmW5YSY8wtcHAv0XW - artifact: package - skip_symbols: true - on: - configuration: Release - - - provider: NuGet - server: https://nuget.smbsrc.net/ - api_key: - secure: WPxjuSouwbCdM6I771BfIbOk8gA883+l9RKUCfFknaUT1vYPmTpT2ABF9r+J0JgR - artifact: /.*\.symbols\.nupkg/ - on: - configuration: Release diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..473c57c --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,65 @@ +trigger: +- master +- develop + +pr: +- master +- develop + +variables: + BuildConfiguration: Release + BuildPlatform: Any CPU + +jobs: +- job: Build + pool: + vmImage: vs2017-win2016 + + steps: + - checkout: self + clean: true + lfs: true + + - task: VisualStudioTestPlatformInstaller@1 + displayName: Install VSTest + + - task: NuGetCommand@2 + displayName: Restore packages + + - powershell: | + $ErrorActionPreference = 'Stop' + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force + Install-Module -Name platyPS -Repository PSGallery -SkipPublisherCheck -Force + New-ExternalHelp -Path "${env:BUILD_SOURCESDIRECTORY}\docs" -OutputPath "${env:BUILD_SOURCESDIRECTORY}\src\PowerShell\bin\${env:BuildConfiguration}" -Force + displayName: Compile documentation + + - task: VSBuild@1 + displayName: Build solution + inputs: + configuration: $(BuildConfiguration) + maximumCpuCount: true + platform: $(BuildPlatform) + env: + RunCodeAnalysis: true + TreatWarningsAsErrors: true + + - task: VSTest@2 + displayName: Test solution + inputs: + codeCoverageEnabled: true + configuration: $(BuildConfiguration) + platform: $(BuildPlatform) + runInParallel: true + + - task: CopyFiles@2 + displayName: Copy files + inputs: + SourceFolder: $(System.DefaultWorkingDirectory) + Contents: | + src\**\bin\$(BuildConfiguration)\** + TargetFolder: $(Build.ArtifactStagingDirectory) + + - task: PublishBuildArtifacts@1 + displayName: Publish artifact + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory) From a4b68111a48cbfcd610445c86382884cd2e57e60 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Mon, 19 Nov 2018 21:58:58 -0600 Subject: [PATCH 4/7] Add badge and fix test MeasureProductOnSystemDrive was failing on hosted build machine. Make test less strict since it's based largely on uncontrollable factors on hosted machines. --- README.md | 6 +++--- azure-pipelines.yml | 1 + .../PowerShell/Commands/MeasureProductCommandTests.cs | 10 ---------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 63bea35..d44842a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Windows Installer PowerShell Module -[![build status: master](https://ci.appveyor.com/api/projects/status/github/heaths/psmsi?branch=master&svg=true)](https://ci.appveyor.com/project/heaths/psmsi/branch/master) -[![github release: latest](https://img.shields.io/github/release/heaths/psmsi.svg?logo=github)](https://github.com/heaths/psmsi/releases/latest) -[![github releases: all](https://img.shields.io/github/downloads/heaths/psmsi/total.svg?logo=github&label=github)](https://github.com/heaths/psmsi/releases) +[![Build Status: develop](https://dev.azure.com/heaths/public/_apis/build/status/psmsi-CI?branchName=develop)](https://dev.azure.com/heaths/public/_build/latest?definitionId=14) +[![GitHub Release: Latest](https://img.shields.io/github/release/heaths/psmsi.svg?logo=github)](https://github.com/heaths/psmsi/releases/latest) +[![GitHub Releases: All](https://img.shields.io/github/downloads/heaths/psmsi/total.svg?logo=github&label=github)](https://github.com/heaths/psmsi/releases) [![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/MSI.svg)](https://powershellgallery.com/packages/MSI) Exposes Windows Installer functionality to PowerShell, providing means to query installed product and patch information and to query views on packages. diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 473c57c..b38250c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,6 +28,7 @@ jobs: - powershell: | $ErrorActionPreference = 'Stop' + $VerbosePreference = 'Continue' Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name platyPS -Repository PSGallery -SkipPublisherCheck -Force New-ExternalHelp -Path "${env:BUILD_SOURCESDIRECTORY}\docs" -OutputPath "${env:BUILD_SOURCESDIRECTORY}\src\PowerShell\bin\${env:BuildConfiguration}" -Force diff --git a/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs index 06fcdbb..d0371c0 100644 --- a/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs @@ -53,11 +53,6 @@ public void MeasureProductOnSystemDrive() Assert.IsTrue(0 < drive.GetPropertyValue("MSISpaceRequired")); Assert.IsTrue(0 < drive.GetPropertyValue("MSITemporarySpaceRequired")); } - else - { - Assert.AreEqual(0, drive.GetPropertyValue("MSISpaceRequired")); - Assert.AreEqual(0, drive.GetPropertyValue("MSITemporarySpaceRequired")); - } } } } @@ -89,11 +84,6 @@ public void MeasureProductOnOtherDrive() Assert.IsTrue(0 < drive.GetPropertyValue("MSISpaceRequired")); Assert.IsTrue(0 <= drive.GetPropertyValue("MSITemporarySpaceRequired")); } - else - { - Assert.AreEqual(0, drive.GetPropertyValue("MSISpaceRequired")); - Assert.AreEqual(0, drive.GetPropertyValue("MSITemporarySpaceRequired")); - } } } } From 6b77dbdfd975bde72a66a2358ea7be683bea61d2 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Tue, 20 Nov 2018 10:51:12 -0600 Subject: [PATCH 5/7] Update version information --- inc/Common.props | 2 +- src/PowerShell/PowerShell.csproj | 21 +++++++++------------ src/PowerShell/packages.config | 6 +++--- test/PowerShell.Test/PowerShell.Test.csproj | 17 ++++++++--------- test/PowerShell.Test/packages.config | 6 +++--- version.json | 8 ++------ 6 files changed, 26 insertions(+), 34 deletions(-) diff --git a/inc/Common.props b/inc/Common.props index 005fe81..517ba0e 100644 --- a/inc/Common.props +++ b/inc/Common.props @@ -8,7 +8,7 @@ v3.5 Properties 512 - true + false diff --git a/src/PowerShell/PowerShell.csproj b/src/PowerShell/PowerShell.csproj index e64dd6a..1c223fa 100644 --- a/src/PowerShell/PowerShell.csproj +++ b/src/PowerShell/PowerShell.csproj @@ -156,9 +156,7 @@ True Designer - - Designer - + @@ -185,9 +183,8 @@ - - - + + @@ -212,22 +209,22 @@ - + $(MSBuildProjectDirectory)\$(MSBuildProjectName).nuspec - $(NuGetCommand) pack "$(ProjectPath)" -Properties "SolutionDir=$(SolutionDir);Configuration=$(Configuration);Platform=$(Platform);Version=$(BuildVersionSimple)" -OutputDirectory "$(OutputPath.TrimEnd('\'))" -Symbols -NonInteractive -NoPackageAnalysis + $(NuGetCommand) pack "$(ProjectPath)" -Properties "SolutionDir=$(SolutionDir);Configuration=$(Configuration);Platform=$(Platform);Version=$(NuGetPackageVersion)" -OutputDirectory "$(OutputPath.TrimEnd('\'))" -Symbols -NonInteractive -NoPackageAnalysis - + - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + - + \ No newline at end of file diff --git a/src/PowerShell/packages.config b/src/PowerShell/packages.config index de33cce..4aa1018 100644 --- a/src/PowerShell/packages.config +++ b/src/PowerShell/packages.config @@ -1,5 +1,5 @@  - - - + + + \ No newline at end of file diff --git a/test/PowerShell.Test/PowerShell.Test.csproj b/test/PowerShell.Test/PowerShell.Test.csproj index 8842092..824bc15 100644 --- a/test/PowerShell.Test/PowerShell.Test.csproj +++ b/test/PowerShell.Test/PowerShell.Test.csproj @@ -129,26 +129,25 @@ - - - false - - - + + + + + - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + - + \ No newline at end of file diff --git a/test/PowerShell.Test/packages.config b/test/PowerShell.Test/packages.config index 1883e30..ec3bf7b 100644 --- a/test/PowerShell.Test/packages.config +++ b/test/PowerShell.Test/packages.config @@ -1,5 +1,5 @@  - - - + + + \ No newline at end of file diff --git a/version.json b/version.json index 7fc54f8..f6aeca9 100644 --- a/version.json +++ b/version.json @@ -1,16 +1,12 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "3.2.0", + "version": "3.3", "publicReleaseRefSpec": [ "^refs/heads/master$" ], "cloudBuild": { "buildNumber": { - "enabled": true, - "includeCommitId": { - "when": "nonPublicReleaseOnly", - "where": "buildMetadata" - } + "enabled": true }, "setVersionVariables": true } From a81b3b5c33bbe517416a623d98b3d7ecf51150cd Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Sun, 2 Feb 2020 11:50:17 -0800 Subject: [PATCH 6/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d44842a..06abcec 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![GitHub Releases: All](https://img.shields.io/github/downloads/heaths/psmsi/total.svg?logo=github&label=github)](https://github.com/heaths/psmsi/releases) [![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/MSI.svg)](https://powershellgallery.com/packages/MSI) -Exposes Windows Installer functionality to PowerShell, providing means to query installed product and patch information and to query views on packages. +Exposes Windows Installer functionality to PowerShell, providing means to query installed product and patch information, and to query views on packages. ## Description From a7f9edbf4d7d13fae2df50f7a19b0499364d0a7b Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Sun, 16 Feb 2020 19:36:52 -0800 Subject: [PATCH 7/7] Require Path parameter for Get-MSISummaryInfo (#40) Fixes #39 --- .../Commands/GetSummaryInfoCommand.cs | 4 ++++ .../Commands/GetSummaryInfoCommandTests.cs | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/PowerShell/PowerShell/Commands/GetSummaryInfoCommand.cs b/src/PowerShell/PowerShell/Commands/GetSummaryInfoCommand.cs index c2b138b..a4f361e 100644 --- a/src/PowerShell/PowerShell/Commands/GetSummaryInfoCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetSummaryInfoCommand.cs @@ -32,6 +32,10 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands [OutputType(typeof(SummaryInfo), typeof(TransformInfo))] public sealed class GetSummaryInfoCommand : ItemCommandBase { + /// + [Parameter(ParameterSetName = ParameterSet.Path, Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + public override string[] Path { get; set; } + /// /// Gets or sets whether transforms within a patch should be enumerated. /// diff --git a/test/PowerShell.Test/PowerShell/Commands/GetSummaryInfoCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/GetSummaryInfoCommandTests.cs index 710d811..fd5ccf3 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetSummaryInfoCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetSummaryInfoCommandTests.cs @@ -22,6 +22,7 @@ using System; using System.IO; +using System.Management.Automation; using Microsoft.Deployment.WindowsInstaller; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -128,5 +129,27 @@ public void GetSummaryInfoFromMst() Assert.AreEqual(new Version(2, 0), info.GetPropertyValue("MinimumVersion")); } } + + [TestMethod] + public void RequiresPath() + { + // Test fix for https://github.com/heaths/psmsi/issues/39 + using (var p = CreatePipeline("get-msisummaryinfo")) + { + try + { + p.Invoke(); + + Assert.Fail("Expected ParameterBindingException"); + } + catch (ParameterBindingException ex) + { + Assert.IsTrue(p.HadErrors); + + // Trimming parameter name since in 5.1 it was " Path". + Assert.AreEqual("Path", ex.ParameterName?.Trim()); + } + } + } } }