You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The publishing process for AWS Tools for PowerShell modules was switched from Publish-Module to Publish-PSResource to publish modules to the PowerShellGallery. Publish-PSResource is creating incorrect dependencies for the same module manifest file.
AWS.Tools.CloudWatch module version 4.1.730 was published using Publish-Module. Under the Package Details section, the dependency shows as expected AWS.Tools.Common (= 4.1.730)
For the same module published with Publish-PSResource the dependency shows as AWS.Tools.Common (>= 4.1.741)
As can be seen from the module manifest file, the RequiredModules section is shown below. Since the RequiredVersion was specified, the module dependency should be equal to the version not greater than equal to the version.
Production is using `1.0.6`. We tried the latest `1.1.0`. Both have the same issue.
➜ Get-Module Microsoft.PowerShell.PSResourceGet ;$PSVersiontable|format-table
Directory: C:\Users\user\Documents\PowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
--------------------------------------------------------
Binary 1.1.0 Microsoft.PowerShell.PSResourceGet Core,Desk {Compress-PSResource,Find-PSResource, …
Name Value
---------
PSVersion 7.4.6
PSEdition Core
GitCommitId 7.4.6
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
Nuspec Publish-Module vs Publish-PSResource screenshot
PowerShell Gallery dependency using Publish-Module :
PowerShellGallery dependency using Publish-PSResource
The text was updated successfully, but these errors were encountered:
afroz429
changed the title
Publish-PSResource is generating incorrect dependency version for RequiredModules in nuspec
Publish-PSResource is generating incorrect dependency version range for RequiredModules in nuspec
Jan 23, 2025
afroz429
pushed a commit
to afroz429/PSResourceGet
that referenced
this issue
Jan 24, 2025
…hen versions are specified in RequiredModules section
Fixes bug with generated nuspec dependency version range when RequiredVersion, MaxiumumVersion and ModuleVersion are specified in RequiredModules section
…hen versions are specified in RequiredModules section
Fixes bug with generated nuspec dependency version range when RequiredVersion,MaxiumumVersion and ModuleVersion are specified in RequiredModules section
Prerequisites
The publishing process for AWS Tools for PowerShell modules was switched from
Publish-Module
toPublish-PSResource
to publish modules to the PowerShellGallery.Publish-PSResource
is creating incorrect dependencies for the same module manifest file.AWS.Tools.CloudWatch module version 4.1.730 was published using
Publish-Module
. Under thePackage Details
section, the dependency shows as expectedAWS.Tools.Common (= 4.1.730)
For the same module published with
Publish-PSResource
the dependency shows asAWS.Tools.Common (>= 4.1.741)
As can be seen from the module manifest file, the
RequiredModules
section is shown below. Since theRequiredVersion
was specified, the module dependency should beequal to
the version notgreater than equal to
the version.It appears that the nuget package that is generated has the following in the nuspec file.
Publish-Module
has<dependency id="ModuleCore" version="[0.0.1]" />
Publish-PSResource
has<dependency id="ModuleCore" version="0.0.1" />
Which according to nuget package version documentation is exact version or greater than equal to.
Steps to reproduce
80368ccb-08f5-4e6c-b341-b17f40985e73
508e05e9-17e1-4951-a60b-4d120775bdbc
RequiredModules
section as shown belowPublish-PSResource
.MyModule
Expected behavior
Since the `RequiredVersion` is specified in the `RequiredModules` section, the dependency should be an exact match.
Actual behavior
The dependency is created as greater than equal to the version specified in the `RequiredVersion`
Error details
It appears that the code is treating
ModuleVersion
andRequiredVersion
as same.See
https://github.com/PowerShell/PSResourceGet/blob/v1.1.0/src/code/PublishHelper.cs#L1177-L1184
https://github.com/PowerShell/PSResourceGet/blob/v1.1.0/src/code/PublishHelper.cs#L1134
Environment data
Visuals
Nuspec
Publish-Module
vsPublish-PSResource
screenshotPowerShell Gallery dependency using
Publish-Module
:PowerShellGallery dependency using
Publish-PSResource
The text was updated successfully, but these errors were encountered: