# MSBuild missing Newtonsoft.Json.dll

Posts: 2 New member
Howdy,
Not sure this is the best place to post this, but here goes...
I and some of my team recently upgraded our visual studio 2017/2019 SQL Change Automation extensions to Version 4.3.20205.21469.
Our solution is currently set up to use (known to be legacy) MSBuild deployments for some steps in our development process.  We're now seeing errors on deployment relating to Newtonsoft.Json.dll.

Setting the diagnostic logging flag for msbuild shows the following output near the error:

...
Path\to\project.sqlproj : error : Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

It took me a fair amount of time to realize I should turn on diagnostic logging and then to find the folder it was looking in for Newtonsoft.Json.dll... and my conclusion is that "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\SqlChangeAutomation\"
is missing Newtonsoft.Json.dll.

As a test/temporary workaround, I grabbed a net45 version 12 copy of Newtonsoft.Json.dll and threw it into that specific folder, and viola, no more error and I'm back to my normal development process.

Now, I am aware that MSBuild is a legacy deployment option, and it's advisable to move to powershell cmdlets, but we haven't gotten there yet.  Seeing as your visx installer is still being updated and apparently includes MSBuild support as it's populating binaries in that folder above, here's hoping you can adjust the next version to resolve this.

Thanks!
Tagged:

• Posts: 606 Rose Gold 5
edited July 30, 2020 1:19PM Answer ✓
Update (July 30th) - This issue has been fixed in  version 4.3.20211 of SQL Change Automation for Visual Studio
Sergio
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools

• Posts: 17 Bronze 1
Running into the same error while attempting to deploy pending scripts.

Using SQL Change Automation version: 4.3.20205.21469
Error:  : Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
• Posts: 14 Bronze 3
@Sergio R We are not yet seeing that version available.
This has pretty much stalled my teams work today.

Any idea on when it will actually be available to install or is there somewhere we can pull an old version to get things working again?
• Posts: 606 Rose Gold 5
edited July 27, 2020 7:05PM
Visual Studio extensions are set to self-update by default, if that didn't happen in your case, you should be able to get it from the Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=vs-publisher-306627.RedgateSqlChangeAutomation
Sergio
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
• Posts: 17 Bronze 1
Downloaded SQL Toolbelt installer today, and it did not update to 4.3.20209
Using SQL Change Automation version: 4.3.20209.21516
Still getting the Newtonsoft.Json error:
C:\Projects\database\SQLCore\PrimeReporting\PrimeReporting.sqlproj: Error:  : Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

• Posts: 14 Bronze 3
Applying the vsix install from the marketplace did not resolve the issue.
I can see the file in the MSBuild folder referenced above now, but every build still fails.
Unlike the originator of this thread, adding the file manually before attempting the vsix install also did not correct the problem.

My other team members attempted the vsix install without having attempted any manual corrections and also report local builds remain broken after the upgrade.
• Posts: 17 Bronze 1
Got a response from RedGate support-
Newtonsoft.json.dll is missing from the Extensions directory: C:\Program Files (x86)\Microsoft Visual Studio\(Visual Studio Version)\(Visual Studio Edition)\Common7\IDE\Extensions\001rr241.rgs\
Manually copying the .dll there resolved the problem for me.
• Posts: 14 Bronze 3
I just got the same reply from support and it worked perfectly for me too.
• Posts: 606 Rose Gold 5
I am sorry that this issue is still occurring, like @garrettloy, @Sean_Lively and @JoeHarkins   mentioned this can be worked around by copying Newtonsoft.json.dll version 12 to the appropriate locations (this is probably already present on your system, so it's just a case of searching and copying):

C:\Program Files (x86)\Microsoft Visual Studio\(Visual Studio Version)\(Visual Studio Edition)\MSBuild\SqlChangeAutomation\
for example: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\SqlChangeAutomation\

C:\Program Files (x86)\Microsoft Visual Studio\(Visual Studio Version)\(Visual Studio Edition)\Common7\IDE\Extensions\001rr241.rgs\
for example C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\001rr241.rgs\

Sergio
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
• Posts: 2 New member
edited July 28, 2020 5:30PM
Just ran through resolving an issue with one of my team members - it seems that for Visual Studio 2017 Professional's 4.3.20209.21516 extension, the dll is still missing from the 001rr241.rgs folder.

I also had problems updating my extension after adding the Newtonsoft.Json.dll files manually to the extension folders. I ended up having to remove the mentioned folders entirely in order to successfully uninstall/reinstall. I believe this is due to the uninstall process only removing what it expects to be there, and then leaving Newtonsoft.Json.Dll because the previous installer didn't put it there, then the new installer doesn't expect it to be there and errors out.

We're unblocked right now but I anticipate my folks having to go in and delete the folders and/or remember to remove newtonsoft.json.dll from those folders when we get another update.
• Posts: 606 Rose Gold 5
I am sorry for this issue, we are investigating this and hopefully, this will be fixed in the next version.
Sergio
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
• Posts: 606 Rose Gold 5
@Sean_Lively
@JoeHarkins

Can you let us know what versions of Visual Studio you were using?
Sergio
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
• Posts: 14 Bronze 3
We verified the issue was with all the folks using VS 2017.
• Posts: 17 Bronze 1
VS2017
• Posts: 3 New member
I ran into this same (or a really similar) issue as well just now.
No windows or VS updates had been installed for a while, but SCA had just gotten automatically updated.
I found that the folder SqlChangeAutomation had a copy of Newtonsoft.Json.dll, but the folder 001rr241.rgs didn't. I copied the dll from the first to the second folder. After that I could build again without errors.

OS: Windows 10 Enterprise
IDE: Visual Studio Enterprise 2017, 15.9.22
SCA: 4.3.20209.21516 (version that triggered the error. Don't know what the previous version was)
• Posts: 1 New member
edited July 29, 2020 3:34PM
My team just ran into the same issue now.
I did the exact same thing that
StevenSegers did and it fixed the issue.
• Posts: 606 Rose Gold 5
We've now released version 4.3.20211 of SQL Change Automation for Visual Studio which should resolve this
Sergio
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools