sarafian / semverps Goto Github PK
View Code? Open in Web Editor NEWPowerShell module to work with Semantic Versioning http://semver.org/
License: GNU General Public License v3.0
PowerShell module to work with Semantic Versioning http://semver.org/
License: GNU General Public License v3.0
Below is Windows PowerShell 5.1 on a recent Windows 10 having .NET Framework 4.8 installed. SemVerPS 1.0
works.
PS C:\WINDOWS\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.1151
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1151
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PS C:\WINDOWS\system32> Uninstall-Module -Name SemVerPS
PS C:\WINDOWS\system32> Install-Module -Name SemVerPS -Repository PSGallery -MaximumVersion 1.0
PS C:\WINDOWS\system32> Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.0\CS\SemVersion.cs"
PS C:\WINDOWS\system32> ConvertTo-SemVer -Version "1.0.0+alpha"
Major : 1
Minor : 0
Patch : 0
Prerelease :
Build : alpha
Below is a restarted Windows PowerShell 5.1 session on a recent Windows 10 having .NET Framework 4.8 installed. A new PowerShell process to avoid a lingering SemVer class/type loaded. SemVerPS 1.1
throws various errors
PS C:\WINDOWS\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.1151
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1151
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PS C:\WINDOWS\system32> Uninstall-Module -Name SemVerPS
PS C:\WINDOWS\system32> Install-Module -Name SemVerPS -Repository PSGallery
PS C:\WINDOWS\system32> Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs"
Add-Type : c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(410) : Warning as Error: Invalid number
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(409) :
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(410) : >>> #pragma warning disable CA1062 // Validate arguments of public methods
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(411) : // If other is null, CompareByPrecedence() returns 1
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(413) : Warning as Error: Invalid number
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(412) : return CompareComponent(Build, other.Build);
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(413) : >>> #pragma warning restore CA1062 // Validate arguments of public methods
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(414) : }
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(558) : Warning as Error: Invalid number
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(557) :
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(558) : >>> #pragma warning disable CA2225 // Operator overloads have named alternates
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(559) : /// <summary>
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(568) : Warning as Error: Invalid number
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(567) : public static implicit operator SemVersion(string version)
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(568) : >>> #pragma warning restore CA2225 // Operator overloads have named alternates
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(569) : {
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(309) : 'Semver.SemVersion.Major.get' must declare a body because it is not marked abstract or extern.
Automatically implemented properties must define both get and set accessors.
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(308) : /// </value>
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(309) : >>> public int Major { get; }
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(310) :
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(317) : 'Semver.SemVersion.Minor.get' must declare a body because it is not marked abstract or extern.
Automatically implemented properties must define both get and set accessors.
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(316) : /// </value>
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(317) : >>> public int Minor { get; }
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(318) :
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(325) : 'Semver.SemVersion.Patch.get' must declare a body because it is not marked abstract or extern.
Automatically implemented properties must define both get and set accessors.
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(324) : /// </value>
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(325) : >>> public int Patch { get; }
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(326) :
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(333) : 'Semver.SemVersion.Prerelease.get' must declare a body because it is not marked abstract or extern.
Automatically implemented properties must define both get and set accessors.
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(332) : /// </value>
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(333) : >>> public string Prerelease { get; }
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(334) :
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(341) : 'Semver.SemVersion.Build.get' must declare a body because it is not marked abstract or extern.
Automatically implemented properties must define both get and set accessors.
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(340) : /// </value>
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(341) : >>> public string Build { get; }
c:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\CS\Semver.cs(342) :
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : Cannot add type. Compilation errors occurred.
At line:1 char:1
+ Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException
+ FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand
PS C:\WINDOWS\system32> ConvertTo-SemVer -Version "1.0.0+alpha"
Unable to find type [Semver.SemVersion].
At C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.1\Public\ConvertTo-SemVer.ps1:15 char:17
+ [OutputType([Semver.SemVersion[]])]
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Semver.SemVersion:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
For what it is worth, same machine the later code block works without problems on a PowerShell 7.1.4. But I think you remember why we need Windows PowerShell :-)
If you don't have time to look into it, can you share some highlights/problems on what changed between 1.0 and 1.1?
Thanks
Hey, I was testing SemVerPS module after installation and powershell cannot load it due to a invalid module.
Steps to reproduce:
Import-Module SemVerPS -Verbose
#VERBOSE: Skipping the Version folder 1.0.0 under Module C:\Program Files\WindowsPowerShell\Modules\semverps as it does not have a valid module manifest file
How to fix it:
Edit ModuleVersion property under SemVerPS.psd1
to match with the folder version: C:\Program Files\WindowsPowerShell\Modules\SemVerPS\1.0.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.