Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Update-ScriptFileInfo adds 2 extra lines each time run #165

Open
@ryancbutler

Description

@ryancbutler

Expected Behavior

Update-ScriptFileInfo should update PSScriptInfo values consistently without adding unnecessary extra lines

Current Behavior

When Update-ScriptFileInfo is run it adds 2 extra lines between

.PRIVATEDATA 

#> 
LINES GET ADDED HERE
<# 

.DESCRIPTION 
This a test

Possible Solution

New lines should not be added when Update-ScriptFileInfo run

Steps to Reproduce (for bugs)

New-ScriptFileInfo -Path .\DEMOSCRIPT.ps1 -Description "This is test script" -version 1.0 -force
update-ScriptFileInfo .\DEMOSCRIPT.ps1 -version 1.1
(Get-Content .\DEMOSCRIPT.ps1  | Measure).count
update-ScriptFileInfo .\DEMOSCRIPT.ps1 -version 1.2
(Get-Content .\DEMOSCRIPT.ps1  | Measure).count
update-ScriptFileInfo .\DEMOSCRIPT.ps1 -version 1.3
(Get-Content .\DEMOSCRIPT.ps1  | Measure).count
update-ScriptFileInfo .\DEMOSCRIPT.ps1 -version 1.4
(Get-Content .\DEMOSCRIPT.ps1  | Measure).count

You'll see the line numbers increase each time update-scriptfileinfo is run.

45
47
49
51

Context

Not critical but something that needs to be watched and cleaned-up for script maintainers.

Your Environment

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.15063.502
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.502
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> Get-Module
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     0.1.1      PowerShellEditorServices.Commands   {ConvertFrom-ScriptExtent, ConvertTo-ScriptExtent, Find-Ast, Get-Token...}
Script     0.1.0      PowerShellEditorServices.VSCode     {Close-VSCodeHtmlContentView, New-VSCodeHtmlContentView, Set-VSCodeHtmlContentView, Show-VSCodeHtmlContentView...}
> Get-Module -ListAvailable PowerShellGet,PackageManagement
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.1.4.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary     1.0.0.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     1.1.3.2    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
> Get-PackageProvider
Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.209        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            1.1.3.2          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, Publi...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
nuget                    2.8.5.208
NuGet                    2.8.5.209        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            1.1.3.2          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, Publi...
PowerShellGet            1.0.0.1
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

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