Skip to content

Update-PSScriptFileInfo removes #requires comments #1832

@peetrike

Description

@peetrike

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Update-PSScriptFileInfo removes #Requires comments that are not required module comments. The sample script to test the problem: Update-PSInfo.ps1

Expected behavior

PS> Get-Content Update-PSInfo.ps1 -first 6

#Requires -Version 5.1
#Requires -Modules Microsoft.PowerShell.PSResourceGet
#Requires -RunAsAdministrator

<#PSScriptInfo
    .VERSION 1.0.0.0

PS> Update-PSScriptFileInfo -Path Update-PSInfo.ps1 -Version 1.1.0
PS> Get-Content Update-PSInfo.ps1

#Requires -Version 5.1
#Requires -Modules Microsoft.PowerShell.PSResourceGet
#Requires -RunAsAdministrator

<#PSScriptInfo
    .VERSION 1.1.0

. . .

Actual behavior

PS> Update-PSScriptFileInfo -Path Update-PSInfo.ps1 -Version 1.1.0
PS> Get-Content Update-PSInfo.ps1
<#PSScriptInfo

.VERSION 1.1.0

. . .
#>

#Requires -Modules Microsoft.PowerShell.PSResourceGet

<#

.DESCRIPTION
. . .

Error details

Environment data

  • PowerShell version: 5.1 and 7.5.1
  • PSResourceGet version: 1.1.1

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions