PowerShell / PowerShellGetv2

PowerShellGet is the Package Manager for PowerShell
https://www.PowerShellGallery.com
MIT License
430 stars 138 forks source link

Register-PSRepository invalid Web Uri #631

Open SylvainMartel opened 3 years ago

SylvainMartel commented 3 years ago

Steps to reproduce

Register-PSRepository -Name internalRepo -SourceLocation= https://adepot:8625/nuget/PSGet

Expected behavior

repo registered

Actual behavior

ScriptStackTrace:
at ThrowError, C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1: line 7115
at Resolve-Location, C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1: line 6123
at Register-PSRepository<Process>, C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1: line 11481
at <ScriptBlock>, <No file>: line 146

System.ArgumentException: The specified Uri 'https://adepot:8625/nuget/PSGet/' for parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.
   at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
fatal: [stnoy090.redacted.local]: FAILED! => {
    "changed": false,
    "msg": "Unhandled exception while executing module: The specified Uri 'https://adepot:8625/nuget/PSGet/' for parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements."
}

This command works fine:

 Invoke-WebRequest -Uri "https://adepot:8625/nuget/PSGet" -Verbose -Credential $(Get-Credential)
StatusCode        : 200
StatusDescription : OK
Content           : <?xml version="1.0" encoding="utf-8"?><service
                    xmlns="http://www.w3.org/2007/app"><workspace><title
                    xmlns="http://www.w3.org/2005/Atom">Default</title><collection href="Packages"><title
                    xmlns="http://...
RawContent        : HTTP/1.1 200 OK
                    X-ProGet-Version: 5.2.30.4
                    Persistent-Auth: true
                    Content-Length: 273
                    Cache-Control: no-cache, no-store, must-revalidate
                    Content-Type: text/xml
                    Date: Wed, 11 Nov 2020 21:11:42 GMT...
Forms             : {}
Headers           : {[X-ProGet-Version, 5.2.30.4], [Persistent-Auth, true], [Content-Length, 273], [Cache-Control,
                    no-cache, no-store, must-revalidate]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : System.__ComObject
RawContentLength  : 273

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14393.3866
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.3866
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

```powershell
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
nuget                    2.8.5.208
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet            2.2.5.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
PowerShellGet            1.0.0.1
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

And to give my personal feedback on powershellget, nuget and al.: It's a complete failure. First, we cannot register a repository with the default powershellget 1.0 that comes on a fresh OS install(windows 2016) So, we need to update poewrshellget, but our servers do not have internet access, so the smart, automated way, would be to register our internal proget depot and update from there, but we can't since it fails. Great! So let's copy it manually. Oh, but first we need to install nuget offline. Just do a search on how to install nuget offline, if you are lucky you will find the article that mentions you have to.. get it from an machine where it is installed and copy the folder manually! Wow, a manual copy, GREAT!

This is a complete mess. Trying to automate this for a new server installation is a nightmare. And to end it all, even when you copy manually nuget, powershelget 2.2.5, packagemanagement 1.47, it STILL fails to register the internal repo. throw hands in air

SydneyhSmith commented 3 years ago

Thanks @kinwolfqc we have been working on PowerShellGet 3.0 to solve many of the frustrating challenges with the current package management situation, it would be great if you could check that out and give us feedback to make sure we are meeting your requirements as we finish building the module: https://github.com/PowerShell/PowerShellGet