I have created a new classlib project in Visual Studio Code. The csproj
file contains two packages: PowerShellStandard.Library
, version 5.1.1, and System.Text.Json
, version 4.7.0. My .cs
file uses System.Text.Json
and System.Management.Automation
.
I am able to compile the code without errors or warnings when running dotnet build
, but when I run the code I get the following error:
Get-JsonString : Could not load file or assembly 'System.Text.Json, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
At line:1 char:1
+ Get-JsonString -input s
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-JsonString], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,UrlCSharpPowerShell.CreateJson
What could be causing this error?