Skip to content
This repository was archived by the owner on Feb 20, 2021. It is now read-only.
This repository was archived by the owner on Feb 20, 2021. It is now read-only.

PSModule doesn't support Nuget packages with authentification (HTTPS) #2

@anpur

Description

@anpur

Prerequisites:

  1. Setup some HTTPS Nuget server which requires authentication
  2. Update your PackageManager to 1.0.0.1 version with Win November Update (it used to work in 1.0.0.0)

Scenario:

  1. Check that Nuget.exe can install packages from your Nuget server
  2. Try to register it as PSRepository:
    Register-PSRepository -Name MyNuget -SourceLocation https://my-nuget/api/v2

You will got error like this:
Register-PSRepository : The specified Uri 'https://my-nuget/api/v2' for parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.

Root cause:
Function Ping-Module from PSModule.psm1 not passing credentials to request.

Fix is not simple
To fix Ping-Module you need simple one-liner: you need to add following line to $WebRequestcmd script inside Ping-Module function:

$request.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

But after that fix I'm getting following warning:

WARNING: Unable to resolve package source 'https://my-nuget/api/v2'.

So source is registered but remains unusable.

Please feel free to contact me for any additional details or reproduction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions