Could not load file or assembly NewtonSoft.Json


When trying to build my project in Visual Studio I get the error “Could not load file or assembly ‘Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed’ or one of its dependencies. The system cannot find the file specified.”

I checked in the Nuget package manager and I do have a version of Newtonsoft.Json but with version 13.0.1 and I don’t know how I can install and/or if it is even necessary.

Tool: Visual Studio
Version: 5.8.8

Hey @Asista ,

Can you let me know what version of VS you are running and what version of PS you are trying to compile for?

Hey @adam,

I’m on Microsoft Visual Studio 2019 Enterprise version 16.9.3.
I’m trying to compile for the default in executable properties which should be powershell 5.

Ok. Strange. I don’t know exactly why this is happening for you but not in my test environments but I’m going to remove the depedency on NewtonSoft since i always seems to cause issues like this.

Hang tight. If you need to roll back to the previous version, you can grab it from our downloads page: Downloads - Ironman Software

5.8.9 is headed to the marketplace with this fix. Please let me know if you still have the problem after upgrade.

Hello @adam,

I’ve just updated to version 5.8.9 but I’m still getting the same error on build.

Hmmm bummer. I thought I completely removed that dependency. I might need some more info but let me poke around to see what else could cause this.

I was having the same issue on 5.8.10 on Visual Studios 2019 Community and I had to roll back to PowerShellTools.5.8.6 to get it building projects again.

I’ve been able to reproduce and fix this issue. A new build should be available on the Marketplace in about an hour.

Hi @adam,

I’ve updated to 5.8.11 and I am now getting the following error on build.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\PowerShell Tools for Visual Studio\PowerShellProTools.targets(5,5): error : Failed to run ‘System.Linq.Enumerable+WhereEnumerableIterator`1[System.Management.Automation.Language.CommandAst]’

Can you let me know which modules you are importing in the script you are trying to compile?

I’m importing the modules AzureAD, IntuneWin32App en 7Zip4Powershell

Now the compile is working, so no idea why it didn’t work yesterday

1 Like