PowerShellBuild icon indicating copy to clipboard operation
PowerShellBuild copied to clipboard

Dependency on variable in parent scope (Build-PSBuildUpdatableHelp)

Open IMJLA opened this issue 3 years ago • 0 comments

Expected Behavior

The following command should successfully complete its call to New-ExternalHelpCab:

Build-PSBuildUpdatableHelp -DocsPath 'C:\Temp\docs' -OutputPath 'C:\Temp\dist\UpdatableHelp'

Current Behavior

Currently an error is thrown if the $ModuleName variable is not correctly defined in the parent scope:

 New-ExternalHelpCab: untitled:Untitled-2:49:29
Line |
  49 |          New-ExternalHelpCab @cabParams > $null
     |                              ~~~~~~~~~~
     | Cannot validate argument on parameter 'LandingPagePath'. Path 'C:\Temp\docs/en-US/.md' is not a file.

Possible Solution

This can be addressed by adding a Module parameter that defaults to the value of the $ModuleName variable

Steps to Reproduce (for bugs)

  1. Launch pwsh
  2. Run this command:
Build-PSBuildUpdatableHelp -DocsPath 'C:\Temp\docs' -OutputPath 'C:\Temp\dist\UpdatableHelp'

Context

This will make it easier to use Build-PSBuildUpdatableHelp in custom psake tasks

Your Environment

  • Module version used: 0.6.1
  • Operating System and PowerShell version:
$PSVersionTable


Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

IMJLA avatar Feb 12 '22 15:02 IMJLA