'How can I use a later version of Markdig than the one that comes with powershell 7.1.3?

The version of Markdig that comes with powershell is really old, so I wanted to use a newer one

I start a new PS Session

[System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object Location | Sort-Object -Property FullName | Select-Object -Property FullName, Location, GlobalAssemblyCache, IsFullyTrusted | where {$_.FullName -match 'Markdig'}

and I get no results - great, no markdig loaded to the session - so should be no problems with side-by-side loading.

I get the latest version of Markdig.Signed from Nuget and Add-Type

Add-Type -path .\application\Depend-NuGet\Markdig.Signed\lib\netstandard2.0\Markdig.Signed.dll -Verbose

but it totally ignores me and adds the old one from the powershell\7 folder

[System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object Location | Sort-Object -Property FullName | Select-Object -Property FullName, Location, GlobalAssemblyCache, IsFullyTrusted | where {$_.FullName -match 'Markdig'}

FullName                                                                           Location                                         GlobalAssemblyCache IsFullyTrusted
--------                                                                           --------                                         ------------------- --------------
Markdig.Signed, Version=0.21.1.0, Culture=neutral, PublicKeyToken=870da25a133885f8 C:\Program Files\PowerShell\7\Markdig.Signed.dll               False           True

So annoying. It would be nice if Add-Type could give a warning or something if it was going to totally ignore what it was asked to do.

Is there any way to solve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source