Skip to content

Prerelease module versions in psd1 should be enclosed with quotes #976

@peombwa

Description

@peombwa

Repro Steps

  • Generate module using TimesWire sample with a prerelease version - --module-version:1.0.0-preview1:
    autorest --powershell --input-file:https://raw.githubusercontent.com/Azure/autorest.powershell/main/samples/TimesWire/timeswire.yaml --module-version:1.0.0-preview1
  • Build module:
    > .\generated\build-module.ps1
    # Generates a module manifest with
    @{
      RootModule = './TimesNewswire.psm1'
      ModuleVersion = '1.0.0'
      PrivateData = @{
        PSData = @{
          Prerelease = preview1
          Tags = ''
          LicenseUri = ''
        }
      }
    }
  • Run module:
    > .\generated\run-module.ps1
  • The following error is thrown:
    Import-Module: D:\Temp\generated\run-module.ps1:52
    Line |
      52 |  Import-Module -Name $modulePath
         |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         | The module manifest 'D:\Temp\generated\TimesNewswire.psd1' could not be processed because it is not a valid PowerShell module manifest file. Remove the elements that are not permitted: At
         | D:\Temp\generated\TimesNewswire.psd1:18 char:20 +       Prerelease = preview1 +                    ~~~~~~~~ The command 'preview1' is not allowed in restricted language mode or a Data section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions