Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly version the Microsoft.WinGet.Source PowerShell module #255

Open
3limin4t0r opened this issue Oct 14, 2024 · 1 comment
Open

properly version the Microsoft.WinGet.Source PowerShell module #255

3limin4t0r opened this issue Oct 14, 2024 · 1 comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. PowerShell

Comments

@3limin4t0r
Copy link

3limin4t0r commented Oct 14, 2024

Description of the new feature / enhancement

At the moment the version of Microsoft.WinGet.Source is set to 0.1.0 which is the default when the definition file is generated.

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:

  • Say you download WinGet.RestSource-Winget.PowerShell.Source.zip from releases.
  • You create the directory "$([Environment]::GetFolderPath('MyDocuments'))\PowerShell\Modules\Microsoft.WinGet.Source\1.1.20230906\".
  • You drop the Microsoft.WinGet.Source.psd1, Microsoft.WinGet.Source.psm1 files and Library 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 because 1.1.20230906 in the path doesn't match the version that is defined in Microsoft.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 the Microsoft.WinGet.Source.psm1 file and manually set the version to 1.1.20230906. This correctly loads the Microsoft.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:

WinGet.RestSource-Winget.PowerShell.Source.zip
└╴Microsoft.WinGet.Source\
  └╴1.1.20230906\  <- {release version}
    ├╴Microsoft.WinGet.Source.psd1 <- containing: ModuleVersion = {release version}
    ├╴Microsoft.WinGet.Source.psm1
    └╴Library\*

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 single Microsoft.WinGet.Source directory merge).

@3limin4t0r 3limin4t0r added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Oct 14, 2024
@denelon
Copy link
Contributor

denelon commented Oct 14, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. PowerShell
Projects
Status: To Do
Development

No branches or pull requests

2 participants