chris-peterson / pwsh-gitlab

:computer: PowerShell module for GitLab
MIT License
22 stars 10 forks source link

Import-Module -Force throws error #95

Closed Stephanevg closed 2 months ago

Stephanevg commented 2 months ago

Hi,

I am using the version 1.112.0 Windows 11.

This is my powershell version:

Name                           Value
----                           -----
PSVersion                      7.4.4
PSEdition                      Core
GitCommitId                    7.4.4
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

I wanted to update my GitLab_Url variable. And noticed that to do so, I need to reimport the module.

When trying to load the module using -Force, I get the following error message


ipmo GitlabCli -Force

PS C:\Users\Stéphane\Documents\GitlabPoc> ipmo GitlabCli -Force #importing using -Force fails...
MethodInvocationException: C:\Program Files\WindowsPowerShell\Modules\GitlabCli\1.112.0\_Init.ps1:72:46
Line |
  72 |  … Reflection.Assembly]::LoadFrom($(Join-Path $libDir "YamlDotNet.dll"))
     |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'C:\Program Files\WindowsPowerShell\Modules\GitlabCli\1.112.0\lib\YamlDotNet.dll'. The
     | system cannot find the path specified."

I believe that this is probably a bug, as we should be able to re-import the module using -Force. Any idea where this could come from ?

chris-peterson commented 2 months ago

Should be resolved with https://github.com/chris-peterson/pwsh-gitlab/pull/81