PowerConfig icon indicating copy to clipboard operation
PowerConfig copied to clipboard

Import-Module -Name "PowerConfig" Fails

Open ronhowe opened this issue 2 years ago • 6 comments

I am hoping this repo is still maintained, or I'd be happy to help with a little guidance.

I tried importing the module and am getting this error:

PS C:\Users\ronhowe\repos\ronhowe\powershell>
PS C:\Users\ronhowe\repos\ronhowe\powershell> Import-Module -Name "PowerConfig"
Add-Type: C:\Users\ronhowe\Documents\PowerShell\Modules\PowerConfig\0.1.6\LoadAssemblies.ps1:60:1
Line |
  60 |  Add-Type -Path "$libPath/*.dll"
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not load file or assembly 'Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
ParserError: Unable to find type [Microsoft.Extensions.Configuration.ConfigurationProvider].
Import-Module: Could not load file or assembly 'PowerConfig.psm1, Culture=neutral, PublicKeyToken=null'. Invalid pointer (0x80004003 (E_POINTER))
PS C:\Users\ronhowe\repos\ronhowe\powershell> 

This worked maybe a year ago (or two). Many versions of .NET and PowerShell later and it seems to have broken for me.

Some hopefully useful debugging information.

PS C:\Users\ronhowe\repos\ronhowe\powershell> pwsh --version
PowerShell 7.3.4
PS C:\Users\ronhowe\repos\ronhowe\powershell> dotnet --version
7.0.203
PS C:\Users\ronhowe\repos\ronhowe\powershell> Get-Module -Name "PowerConfig" -ListAvailable

    Directory: C:\Users\ronhowe\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     0.1.6                 PowerConfig                         Desk      {Add-PowerConfigCommandLineSource, Add-PowerConfigEnvironmentVari…

PS C:\Users\ronhowe\repos\ronhowe\powershell>

Let me know if I can help. I would love to keep this going. I have forked your repo and will try to figure out a fix. (I have some software development experience).

ronhowe avatar May 07 '23 01:05 ronhowe

Looks like some of the dependencies may need an update to net6 or net7, or maybe I can get it working on standard if the surface isn't too huge.

JustinGrote avatar May 07 '23 04:05 JustinGrote

Sounds good. Nooooooooooooo rush! LOL Would love for it to work, but I'm not chomping at the bit.

ronhowe avatar May 07 '23 04:05 ronhowe

Hi, Justin.

I was still hoping this could be a thing. I can't import PowerConfig and Az.Resources at the same time due to some low-level dependencies. Could PowerConfig be updated to .NET 9?

ronhowe avatar Dec 27 '24 16:12 ronhowe

So it works fine by itself, but the common dependencies are tricky. It would need to be rewritten to use an ALC, or otherwise track the same versions that Az uses.

JustinGrote avatar Dec 27 '24 18:12 JustinGrote

image

OK. I have a workaround. I just really liked the concept.

Thanks for responding.

Have a lovely holiday.

ronhowe avatar Dec 27 '24 18:12 ronhowe

It is still on my radar! I just have a stack of stuff on top of it unfortunately. I need clones :)

JustinGrote avatar Dec 27 '24 18:12 JustinGrote