Powershell tyring to load old (and rare?) version of package. Works in VSCode

I am using Mailkit 2.15 which is dependent on MimeKit 2.15 which is dependent on System.Buffers 4.5.1. In VS Code this works fine but when ran directly in PS then it tries to load System.Buffers 4.0.2.0 which is not installed or even available on nuget. Another strange thing is that even if I comment out the line to load System.Buffers it still works in VS Code and the same error happens in PS.

Exception calling “Send” with “1” argument(s): “Could not load file or assembly ‘System.Buffers, Version=4.0.2.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ or one of its dependencies. The system cannot find the file
specified.”

I have been able to resolve this by using the net46 dll files for all 3 packages instead of the netstandard2.0 ones.

2 Likes