Product: PowerShell Universal Version: 5.6.13
I’m trying to use PostgreSQL as a data source for my script in Universal via Npgsql.
The data resides on another server then the one where PSU is running on.
I run PSU inside a docker container.
Looking at this page:
Ironman Software Support
I see that PSU v5 should run on .NET 8.
However, looking at this page:
docs.powershelluniversal.com
I see that v5 uses .NET 9
I could not get Install-Package to run inside the container so I copied the DLL files to the container itself:/root/packages/Microsoft.Extensions.Logging.Abstractions.10.0.2/root/packages/Npgsql.10.0.1
PS: the issue I got when I tried to install the packages:Install-Package: Package ‘Npgsql’ failed to be installed because: End of Central Directory record could not be found.
The when trying to load the the types/DLL’s like this:Add-Type -Path “/root/packages/Microsoft.Extensions.Logging.Abstractions.10.0.2/lib/net8.0/Microsoft.Extensions.Logging.Abstractions.dll”Add-Type -Path “/root/packages/Npgsql.10.0.1/lib/net8.0/Npgsql.dll”
I get these errors:Could not load file or assembly '/root/packages/Microsoft.Extensions.Logging.Abstractions.10.0.2/lib/net8.0/Microsoft.Extensions.Logging.Abstractions.dll'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)Could not load file or assembly '/root/packages/Npgsql.10.0.1/lib/net8.0/Npgsql.dll'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
PS: I did try to load the .NET 9 versions of these files as well, same issues.
When I set the Execution Environment to “Powershell 7” I only see the error for “Microsoft.Extensions.Logging.Abstractions.10.0.2”
When I use the default “Integrated” environment I get messages for both DLL’s
I did go into the container and started a Powershell session, load the DLL’s and started querying the DB. It worked fine. I could load the .NET 8 versions of these DLL’s and got no complaints at any moment.
My questions are these:
How can I have PSU load these automatically when PSU starts?
What is the best or recommended way to (re)use connections?
Cheers!
Steven
Npgsql has a very low user base. I see almost zero documentation. Personally, expect issues.