You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
We have developed custom Powershell modules to ease the management of third party solutions from developers laptop and Azure DevOps pipelines.
We don't have any issues when registrating these modules from a local environment, however we have this error thrown when we register our NuGet repository a from Azure pipeline.
Steps to reproduce
We have created a YAML pipeline with a powershell step to register and install our custom powersell module.
The content of the powershell script is:
Write-Host"Agent configuration"$PSVersionTableWrite-Host"Powershell module already installed"Get-Module-ListAvailable PackageManagement, PowerShellGet
Write-Host"List available package providers"Get-PackageProvider-ListAvailable
Write-Host"Account email used to access DevOps feed is $(devOpsFeedAccountEmail)"$feedLocation="https://pkgs.dev.azure.com/mycompany/_packaging/devops/nuget/v2"Register-PSRepository"MyCompany-DevOps"`-SourceLocation $feedLocation`-PublishLocation $feedLocation`-InstallationPolicy "Trusted"# => Error is thrown during this Register-PSRepository stepWrite-Host"Prepare credentials for account $(devOpsFeedAccountEmail) to access the DevOps feed."$patToken="$env:devOpsFeedAccountToken"|ConvertTo-SecureString-AsPlainText -Force
$credsAzureDevopsServices=New-Object System.Management.Automation.PSCredential("$(devOpsFeedAccountEmail)",$patToken)
Write-Host"Install and import the module MyCompany.Scripts to the current user session..."Install-Module-Name XXXX.YYYYYY -Repository MyCompany-DevOps -Credential $credsAzureDevopsServices-Force -Scope CurrentUser
Import-Module MyCompany-Scripts -Force
Write-Host"Install and import OK!"
Expected behavior
Our custom NuGet repository should be correctly added.
Actual behavior
During the execution of the Register-PSRepository command, we obtain the following error.
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet--V does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet--V does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Test-Path: Value cannot be null. (Parameter 'The provided Path argument was null or an empty collection.')
The root cause seems related to a path that is not correctly setup (Test-Path null Path argument), however I don't really understand why it is failing.
Thanks in advance for your help!
Environment data
❯ $PSVersionTable
Name Value
---------
PSVersion 7.2.2
PSEdition Core
GitCommitId 7.2.2
OS Linux 5.13.0-1021-azure #24~20.04.1-Ubuntu SMP …
Platform Unix
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
>Get-Module-ListAvailable PowerShellGet,PackageManagement
Name : PackageManagement
Path : /opt/microsoft/powershell/7/Modules/PackageManagement/Packa
geManagement.psd1
Description : PackageManagement (a.k.a. OneGet) is a new way to discover
Description : PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, DSC Resources, Role Capabilities and Scripts.
Guid : 1d73a601-4a6c-43c5-ba3f-619b18bbb404
Version : 2.2.5
ModuleBase : /opt/microsoft/powershell/7/Modules/PowerShellGet
ModuleType : Script
PrivateData : {SupportedPowerShellGetFormatVersions, PSData, PackageManagementProviders}
AccessMode : ReadWrite
ExportedAliases : {[inmo,inmo], [fimo,fimo], [upmo,upmo], [pumo,pumo]}
ExportedCmdlets : {}
ExportedFunctions : {[Find-Command,Find-Command], [Find-DSCResource,Find-DSCResource], [Find-Module,Find-Module], [Find-RoleCapability,Find-RoleCapability]…}
ExportedVariables : {[PSGetPath, ]}
NestedModules : {}
Context
We have developed custom Powershell modules to ease the management of third party solutions from developers laptop and Azure DevOps pipelines.
We don't have any issues when registrating these modules from a local environment, however we have this error thrown when we register our NuGet repository a from Azure pipeline.
Steps to reproduce
We have created a YAML pipeline with a powershell step to register and install our custom powersell module.
The content of the powershell script is:
Expected behavior
Our custom NuGet repository should be correctly added.
Actual behavior
During the execution of the Register-PSRepository command, we obtain the following error.
The root cause seems related to a path that is not correctly setup (Test-Path null Path argument), however I don't really understand why it is failing.
Thanks in advance for your help!
Environment data
The text was updated successfully, but these errors were encountered: