PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
486 stars 92 forks source link

Install/Save-PSResource creates version folder using prerelease name #261

Closed ThomasNieto closed 3 years ago

ThomasNieto commented 4 years ago

Running Save-PSResource -Name PowerShellGet -Path C:\Temp -Prerelease will create a C:\Temp\PowerShellGet\3.0.0-beta10. Import-Module will throw an error because the folder name and version in the psd1 do not match.

Import-Module C:\Temp\PowerShellGet
Import-Module: The specified module '.\PowerShellGet\' was not loaded because no valid module file was found in any module directory.

# Fixed by renaming the folder to remove -beta10
cd c:\temp\PowerShellGet
Rename-Item .\3.0.0-beta10\ .\3.0.0
cd c:\temp
Import-Module .\PowerShellGet
issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.98. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

PaulHigin commented 4 years ago

I am seeing the same issue with Install-PSResource cmdlet.

Install-PSResource -Name Microsoft.PowerShell.SecretManagement -Prerelease -Repository PSGallery

dir 'C:\Users\user\OneDrive - Microsoft\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement\'

    Directory: C:\Users\user\OneDrive - Microsoft\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
la---           9/18/2020  9:39 AM                0.5.2-preview3
ThomasNieto commented 4 years ago

@PaulHigin what version of PowerShellGet are you running?

PaulHigin commented 4 years ago

3.0.0-beta10

JustinGrote commented 3 years ago

Since https://github.com/PowerShell/PowerShell/issues/2983 is likely a long way out, this should revert to the old folder conventions now because it currently doesn't work with any powershell version and it's extremely annoying to install a prerelease module only to have to go into the folder and rename it, I had to write a wrapper function to save myself the trouble.

alerickson commented 3 years ago

This will be resolved with the release of Preview 11.