MSBuild missing Newtonsoft.Json.dll
garrettloy
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:
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:
Using "DBPatchTask" task from assembly "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\SqlChangeAutomation\RedGate.Versioning.Client.MsBuild.dll".
Task "DBPatchTask" (TaskId:22)
...
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!
...
Generating "Path\to\obj\Debug\output.sql"... (TaskId:22)
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:
Best Answer
-
Sergio R Posts: 610 Rose Gold 5Update (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
Answers
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.
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?
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
Downloaded the extension from VS Marketplace per the link, and it did update to 20209:
Using SQL Change Automation version: 4.3.20209.21516
Still getting the Newtonsoft.Json error:
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.
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.
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\
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
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.
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
@JoeHarkins
Can you let us know what versions of Visual Studio you were using?
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
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)
I did the exact same thing that
StevenSegers did and it fixed the issue.
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools