Reference libraries from AspNetCore framework in PowerShell binary module #23888
-
I'm writing a PowerShell (v7) binary module for managing AspNetCore Data Protection keys, so my module references Microsoft.AspNetCore.DataProtection.dll from Microsoft ASP.NET Core framework. I'm getting the following error when importing the module:
The only way to resolve this issue is to publish my module as a self-contained library, so that all dependencies are published alongside the module library (so it is the whole AspNetCore). I tried to add I tried to modify pwsh's Are there any other options to reference AspNetCore framework from a PowerShell binary module? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Been there, done that. See rhubarb-geek-nz/AspNetForPowerShell. Welcome to dll hell. This is an overview of the mappings you need to maintain, it is a little of of date but you get the idea. The version of PowerShell needs to match the version of DotNet and AspNet runtimes. Then multiply that by Windows, Linux glib/musl, MacOS,arm/intel, 32bit and 64bit and you have quite a few combinations to maintain. Fortunately that is all done here,
With the goal of creating packages (msi, pkg, deb, rpm ) which install the AspNetCore runtime in %ProgramFiles%\PowerShell\7\Modules or /opt/microsoft/powershell/7/Modules as appropriate. So don't put the AspNetCore runtime in the PSGallery, your package would need about 200 copies of it within your module to match which ever installation of PowerShell is running. So if you must use PowerShell then consider the alternatives....
I recommend starting by using the dotnet PowerShell tool as the execution environment, that should give you access to the installed AspNetCore runtime. |
Beta Was this translation helpful? Give feedback.
Been there, done that. See rhubarb-geek-nz/AspNetForPowerShell.
Welcome to dll hell. This is an overview of the mappings you need to maintain, it is a little of of date but you get the idea.
The version of PowerShell needs to match the version of DotNet and AspNet runtimes. Then multiply that by Windows, Linux glib/musl, MacOS,arm/intel, 32bit and 64bit and you have quite a few combinations to maintain.
Fortunately that is all done here,
With the goal of creating packages (msi, pkg, deb, rpm ) which install the AspNetCore runtime in %ProgramFiles%\PowerShell\7\Modu…