Open 3limin4t0r opened 3 weeks ago
We're working on the Entra ID authentication support, and as a part of this I'm anticipating setting up the build pipeline so we can sign and publish the module to the PowerShell gallery. We're looking at versioning as a part of the release process which should address the issue you're having.
Thanks for bringing this up!
Description of the new feature / enhancement
At the moment the version of
Microsoft.WinGet.Source
is set to0.1.0
which is the default when the definition file is generated.https://github.com/microsoft/winget-cli-restsource/blob/05d4836affcc6970957bb03b67e26914113438e9/Tools/PowershellModule/src/Microsoft.WinGet.Source.psd1#L17
I suggest that this version mirrors the release version of this repository. (see releases) For example, the version should be set to
1.1.20230906
. Which is the newest release at the time of writing this issue.The reason I'm proposing this change is to simplify installing multiple versions of the PowerShell module. (see: Installing Multiple Versions of a Module)
Proposed technical implementation details
Let's look at the following scenario:
WinGet.RestSource-Winget.PowerShell.Source.zip
from releases."$([Environment]::GetFolderPath('MyDocuments'))\PowerShell\Modules\Microsoft.WinGet.Source\1.1.20230906\"
.Microsoft.WinGet.Source.psd1
,Microsoft.WinGet.Source.psm1
files andLibrary
directory in there.If you open up a new PowerShell window the module is not loaded, nor can you load it with the
Import-Module Microsoft.WinGet.Source
command. The reason the module cannot be loaded is because1.1.20230906
in the path doesn't match the version that is defined inMicrosoft.WinGet.Source.psd1
.Of course there would be the option to rename the directory to
0.1.0
instead, but if a future release does not update this version it will conflict with previous a previously installed version. The current solution is to edit theMicrosoft.WinGet.Source.psm1
file and manually set the version to1.1.20230906
. This correctly loads theMicrosoft.WinGet.Source
when opening a new PowerShell window. However in my opinion it's the job of the repository maintainers to correctly set this version when publishing a release.As a side note it would also be nice if the contents of the
.zip
folder looks like this:This would allow users to simply drag-n-drop the
Microsoft.WinGet.Source
directory to their"$([Environment]::GetFolderPath('MyDocuments'))\PowerShell\Modules\"
directory to install the module without conflicting with previous installed versions (with the exception of a singleMicrosoft.WinGet.Source
directory merge).